Initial commit: VoIdeaAI - voice-first AI idea assistant
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""Agent service for VoIdea."""
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
from app.agents.registry import AgentRegistry
|
||||
|
||||
|
||||
class AgentService:
|
||||
def __init__(self, registry: AgentRegistry):
|
||||
self.registry = registry
|
||||
|
||||
def list_agents(self) -> list[dict[str, Any]]:
|
||||
return self.registry.list_agents()
|
||||
|
||||
def get_agent(self, name: str) -> Optional[dict[str, Any]]:
|
||||
agent = self.registry.get(name)
|
||||
if not agent:
|
||||
return None
|
||||
return {
|
||||
"name": agent.name,
|
||||
"version": agent.version,
|
||||
"description": agent.description,
|
||||
"status": agent.status.value,
|
||||
"last_run": agent.last_run.isoformat() if agent.last_run else None,
|
||||
}
|
||||
|
||||
async def run_agent(
|
||||
self, name: str, context: Optional[dict[str, Any]] = None,
|
||||
) -> dict[str, Any]:
|
||||
result = await self.registry.run_agent(name, context)
|
||||
return {
|
||||
"success": result.success,
|
||||
"message": result.message,
|
||||
"data": result.data,
|
||||
"errors": result.errors,
|
||||
"duration_ms": result.duration_ms,
|
||||
}
|
||||
Reference in New Issue
Block a user