Kagura Agent Publishing Guide
This guide provides instructions on how to create, test, and publish agents for the Kagura platform.
Repository Structure
kagura-agents/
├── src/
│ └── agent_name/
│ ├── agent.yml
│ ├── state_model.yml
│ └── tools.py
├── tests/
│ └── agent_name/
│ └── test_agent.py
├── examples/
│ └── agent_name/
│ └── example.py
├── pyproject.toml
├── uv.lock
└── README.md
Creating an Agent
Before creating a new agent, make sure to install the Kagura CLI and create a new agent template.
Building An Agent
See: Building Your First Agent
Testing (tests/agent_name/test_agent.py)
import pytest
from kagura.core.agent import Agent
@pytest.mark.asyncio
async def test_agent():
agent = Agent.assigner("agent_name")
result = await agent.execute({
"input": "test data"
})
assert result.SUCCESS
Make sure to run the tests before publishing the agent. Also see the CONTIBUTING guide for more information.
Example Usage (examples/agent_name/example.py)
from kagura.core.agent import Agent
async def run_example():
agent = Agent.assigner("agent_name")
result = await agent.execute({
"input": "example data"
})
print(result.output)
Agent Documentation (agents/agent_name/README.md)
# Agent Name
## Purpose
Brief description of what the agent does.
## Configuration
Key configuration options and their meanings.
## Usage
Example of how to use the agent.
## Dependencies
List of required packages.
Publishing
-
Create GitHub repository
-
Install agents using Kagura CLI
Best Practices
-
Documentation
- Include clear README for each agent
- Document all configuration options
- Provide usage examples
-
Testing
- Write unit tests for each agent
- Include edge cases
- Test multilingual support
-
Dependencies
- List all requirements
- Use version constraints
- Keep dependencies minimal
-
Code Quality
- Follow Python style guide
- Use type hints
- Add proper error handling