> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mindblix.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating Custom Agents

> Step-by-step guide to building custom AI agents tailored to your domain and use case.

## Overview

While MINDBLIX provides 100+ pre-built agent templates, you may need custom agents for specialized tasks. This guide walks you through creating one from scratch.

***

## Agent Definition

Every custom agent requires three components:

> **System Prompt**
>
> Defines the agent's personality, expertise, and behavior rules.

> **Tool Configuration**
>
> Specifies which external tools the agent can use.

> **Output Schema**
>
> Defines the structure of the agent's output.

***

## Step-by-Step Guide

**1. Define the Agent's Purpose**

Start by clearly defining what your agent should do:

```python theme={null}
AGENT_CONFIG = {
    "name": "Patent Analyzer",
    "description": "Analyzes patent documents for novelty and prior art",
    "domain": "legal",
    "version": "1.0.0"
}
```

**2. Write the System Prompt**

The system prompt shapes the agent's behavior:

```python theme={null}
SYSTEM_PROMPT = """
You are a Patent Analysis Agent specialized in:
- Analyzing patent claims for novelty
- Identifying prior art references
- Evaluating patent strength and validity
- Generating patent landscape reports

Rules:
- Always cite specific patent numbers when referencing prior art
- Provide confidence scores for all assessments
- Output in structured JSON format
- Flag potential conflicts of interest
"""
```

**3. Configure Tools**

Define which tools your agent can access:

```python theme={null}
TOOLS = [
    {
        "name": "patent_search",
        "description": "Search patent databases (USPTO, EPO, WIPO)",
        "parameters": {
            "query": "string",
            "jurisdiction": "string",
            "date_range": "object"
        }
    },
    {
        "name": "document_reader",
        "description": "Extract text from PDF patent documents",
        "parameters": {
            "file_path": "string"
        }
    }
]
```

**4. Define Output Schema**

Specify the expected output structure:

```json theme={null}
{
  "type": "object",
  "properties": {
    "novelty_score": { "type": "number", "min": 0, "max": 1 },
    "prior_art": {
      "type": "array",
      "items": {
        "patent_number": "string",
        "relevance": "number",
        "summary": "string"
      }
    },
    "recommendation": { "type": "string", "enum": ["file", "revise", "abandon"] },
    "confidence": { "type": "number" }
  }
}
```

**5. Deploy**

Deploy your agent via the API:

```bash theme={null}
curl -X POST http://localhost:8000/api/v1/agents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d @patent-analyzer-config.json
```

***

## Best Practices

> **Keep prompts focused**
>
> Each agent should do one thing well. If your prompt is trying to handle multiple domains, consider splitting into multiple agents.

> **Define clear output schemas**
>
> Structured output makes it easier to chain agents together in workflows and parse results programmatically.

> **Test with edge cases**
>
> Test your agent with ambiguous inputs, missing data, and adversarial prompts to ensure robustness.

> **Version your agents**
>
> Always version your agent configurations so you can roll back if a new version doesn't perform as expected.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.