Creating Custom Agents
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Creating custom agents in the WIREDUP system involves leveraging a revolutionary AI Auto-Wiring framework designed for automatic dependency injection and modular capability management. The system allows developers to build intelligent agents that are decoupled from their underlying services, such as environment configuration, Model Context Protocol (MCP) integrations, and secure SSH management.
By extending the provided base classes, developers can create specialized agents—such as Research, Execution, or Coordination agents—that automatically receive necessary dependencies and can dynamically discover and utilize a wide array of Skills & Capabilities.
Sources: README.md:5-13, AGENT.md:14-22
Agent Architecture
The agent system is built on a hierarchical architecture where the Auto-Wiring engine sits at the core, managing the lifecycle and dependencies of all components. Custom agents inherit from a common base that provides essential hooks for logging, configuration, and skill usage.
Component Hierarchy
The following diagram illustrates how agents interact with the core system components.
The BaseAgent is the primary abstract class that every custom agent must implement. It manages an internal dictionary of _skills and provides methods for configuration retrieval.
Sources: src/agents/base_agent.py:27-45, AGENT.md:38-55
Core Data Structures
| Class | Purpose | Key Fields/Methods |
|---|---|---|
AgentContext | Encapsulates execution-specific data. | session_id, user_id, metadata, state |
BaseAgent | Abstract foundation for all agents. | execute(), add_skill(), use_skill() |
AutoWire | Dependency injection and resolution. | register(), resolve(), discover_configs() |
Sources: src/agents/base_agent.py:18-24, src/agents/base_agent.py:47-65, README.md:65-72
Implementation Workflow
Creating a custom agent follows a structured process of definition, registration, and execution.
1. Defining the Agent Class
Custom agents must inherit from BaseAgent and implement the asynchronous execute method. This method is the primary entry point for agent logic.
from src.agents.base_agent import BaseAgent, AgentContext
class ResearchAgent(BaseAgent):
async def execute(self, task: str, context: AgentContext) -> dict:
self.log_info(f"Researching: {task}")
# Custom logic here
return {"success": True, "result": "Information found"}
Sources: src/agents/base_agent.py:47-65, AGENT.md:120-137
2. Auto-Wiring Registration
The Auto-Wiring system handles agent instantiation and dependency injection. Agents can be registered using factory functions or decorators.
Registration allows for scoping (e.g., Scope.SINGLETON) and tagging for discovery.
Sources: AGENT.md:92-104, examples/basic_agent.py:53-62
Skills and Capabilities
Custom agents can be enhanced by attaching "Skills" from the Skills Registry. These represent discrete functions like web searching, code execution, or database querying.
Skill Integration Flow
| Skill Category | Examples | Usage |
|---|---|---|
| Research | web_search, web_scrape | Information gathering. |
| Execution | code_execution, ssh_command | System operations and remote commands. |
| Reasoning | text_generation, logical_reasoning | NLP and inference. |
Sources: SKILLS.md:41-55, SKILLS.md:105-120, src/agents/base_agent.py:67-85
Advanced Configuration
Agents can be configured through multiple sources, including JSON/YAML files and environment variables. The system uses a specific naming convention for environment variables: AI_AGENTS_[AGENT_NAME]_[PROPERTY].
# Example environment configuration
AI_AGENTS_RESEARCH_AGENT_MODEL=gpt-4
AI_AGENTS_RESEARCH_AGENT_TEMPERATURE=0.7
Inside the code, these values are accessed via the get_config method inherited from BaseAgent.
Sources: AGENT.md:213-228, src/agents/base_agent.py:101-104
Summary
Creating custom agents in WIREDUP provides a production-ready framework for building modular AI entities. By leveraging the BaseAgent abstraction and the AutoWire engine, developers can focus on agent-specific logic while the system automatically manages dependencies, skills, and configuration. This architecture ensures that agents remain testable, extensible, and capable of operating across diverse environments.