Guides
Adding New Agents
Guide to adding new AI agents to your application
This guide walks you through the process of adding new AI agents to your Agentic Templates application.
Implementation Guide
Follow these steps to implement a new agent in your application.
1. Implement the Agent UI
Start with the agent configuration in the dashboard repository. This is where you’ll define how your agent appears and behaves in the UI.
Create the agent configuration in lib/agents/your-agent.agent.ts
Update the index file in lib/agents/index.ts
Update schemas/agent.ts
with the input types for the agent
Update schemas/api.ts
with the response body expected from the API
Add the handler to services/agentService.ts
Implement the client side api for the handler in services/api.ts
2. Implement the API Endpoints
2.1 Update the infrastructure to support the new agent.
Update the infra/api.ts
file
Update the infra/queues.ts
file
Update the infra/topic.ts
file
2.2 Update the orchestrator to route the request to the order topic
Update the metadata/agent-plane.schema.ts
file with inputs types
Update the metadata/order.enum.ts
file with the cost of the agent
Write the primary adapter in adapters/primary/your-agent-action.adapter.ts
Write the usecase in usercase/your-agent-action.usecase.ts
Create a function for the primary adapter in functions/src/orchestrator.api.ts
2.3 Add a new agent module to the agent-plane
Create a new directory as agent-plane/your-agent
Create the following directory structure:
Implement the metadata for the agent in metadata/your-agent.schema.ts
Implement the prompt for the agent in metadata/your-agent.prompt.ts
Implement the primary adapter in adapters/primary/your-agent-action.adapter.ts
Implement the usecase in usercase/your-agent-action.usecase.ts
Implement the secondary adapter in adapters/secondary/openai.adapter.ts
Create a function for the primary adapter in functions/src/agent-plane.api.ts
This completes the implementation of your new agent. The agent will now:
- Accept user input through the UI
- Validate and process the request through the API
- Generate content using OpenAI
- Store the deliverable in the database
- Return the result to the user
Remember to:
- Test each component thoroughly
- Handle errors appropriately
- Follow the AMU pattern for clean architecture
- Use proper typing and validation
- Document your code
- Add appropriate logging
- Follow security best practices
Was this page helpful?