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

# Build From Existing Agent

> Use templates and proven agent patterns to accelerate development and reach production success faster

This guide shows how to start from an existing agent instead of generating one from scratch. Starting with templates or proven patterns lets you ship faster while learning Hive concepts.

## When to Use This Path

Use this approach when you want to:

* Reuse a proven graph pattern
* Add new capabilities to an existing workflow
* Create a variant for a different team, market, or policy
* Fix recurring failures and ship a refined version

## Prerequisites

* Existing agent under `exports/` (for example `exports/support_ticket_agent`) or `examples/`
* Hive environment set up with `./quickstart.sh`
* A clear change target: goals, constraints, nodes, or tools

> **Tip**: Explore [use cases and templates](/getting-started/use-cases) to find a starting point that matches your workflow.

## 1. Copy the Base Agent

From `exports/`:

```bash theme={null}
cp -R exports/support_ticket_agent exports/support_ticket_agent_v2
```

Or start from an example agent:

```bash theme={null}
cp -R examples/support_ticket_agent exports/support_ticket_agent_v2
```

Rename internal identifiers as needed (`name`, package/module references, and test fixtures).

## 2. Update Goal and Constraints First

Open the new agent files and update:

* goal statement
* success criteria
* hard/soft constraints
* required capabilities

Start with goal updates before touching node logic. This keeps implementation aligned to measurable outcomes.

## 3. Change Graph Structure

Typical modifications:

* Add node(s) for new tool calls or validation
* Add conditional edges for fallback/retry paths
* Insert `human_input` gates for sensitive actions
* Split overloaded nodes into smaller steps

Use these references while editing:

* [Defining Goals](/building/goals)
* [Node Types](/building/nodes)
* [Edge Configuration](/building/edges)
* [Human-in-the-Loop](/building/human-in-the-loop)

## 4. Validate the New Agent

```bash theme={null}
PYTHONPATH=exports uv run python -m support_ticket_agent_v2 validate
PYTHONPATH=exports uv run python -m support_ticket_agent_v2 info
```

If validation fails, resolve schema, routing, or missing capability errors before testing.

## 5. Run Regression + New Behavior Tests

```bash theme={null}
PYTHONPATH=exports uv run pytest exports/support_ticket_agent_v2/tests/ -v
```

Add tests for:

* unchanged baseline behavior
* new branches and constraints
* expected failure and escalation paths

## 6. Smoke Run

```bash theme={null}
PYTHONPATH=exports uv run python -m support_ticket_agent_v2 run --input '{
  "task": "example input"
}'
```

Use standard runs during fast iteration.

## 7. Promote Safely

Before replacing the original agent:

1. Verify success criteria are met on representative inputs.
2. Confirm hard constraints are never violated.
3. Keep the previous version available for rollback.

## Recommended Versioning Pattern

Use explicit suffixes for major revisions:

* `agent_name_v2`
* `agent_name_v3`

Avoid in-place edits to production agents without version history.

## Next Steps

<CardGroup cols={2}>
  <Card title="Testing" icon="vial" href="/building/testing">
    Strengthen regression coverage and edge-case checks
  </Card>

  <Card title="Key Concepts" icon="lightbulb" href="/building-agent/concepts/overview">
    Revisit runtime and evolution concepts before major refactors
  </Card>

  <Card title="Deployment" icon="rocket" href="/building/deployment">
    Prepare your refined agent for production
  </Card>

  <Card title="Iteration" icon="arrows-rotate" href="/building/iteration">
    Evolve your agent based on production feedback
  </Card>
</CardGroup>
