Core API¶
Core components for agent orchestration and task management.
AgentOrchestrator¶
The main orchestrator for managing multiple agents and parallel task execution.
from legionhercules.core.orchestrator import AgentOrchestrator
from legionhercules.llm.ollama_provider import OllamaProvider
from legionhercules.tools.base import ToolRegistry
# Create components
llm = OllamaProvider(model="llama3.2")
tools = ToolRegistry.create_default_registry()
# Create orchestrator
orchestrator = AgentOrchestrator(
llm_provider=llm,
tool_registry=tools,
max_concurrent_tasks=5,
)
# Initialize
await orchestrator.initialize()
Methods¶
register_agent(config)¶
Register an agent configuration.
create_task(description, **kwargs)¶
Create and queue a new task.
execute_parallel(tasks)¶
Execute multiple tasks in parallel.
Agent¶
Individual agent that can execute tasks using tools and LLM.
from legionhercules.core.agent import Agent, AgentConfig
config = AgentConfig(
name="my_agent",
model="llama3.2",
system_prompt="You are a helpful assistant.",
)
agent = Agent(config, llm, tools)
await agent.initialize()
Task¶
Represents a unit of work to be executed.