Remove alternative a2a options, there will only one

This commit is contained in:
Yiorgis Gozadinos 2025-10-09 11:20:00 +03:00
parent c7c3eaefe5
commit e7451116d7
No known key found for this signature in database
2 changed files with 8 additions and 44 deletions

View file

@ -81,22 +81,15 @@ def a2a_to_pydantic_messages(a2a_messages: list[Message]) -> list[ModelMessage]:
return []
def create_qa_a2a_app(
db_path: Path,
deep: bool = False,
):
"""Create an A2A app for the QA agent.
def create_a2a_app(db_path: Path):
"""Create an A2A app for the conversational QA agent.
Args:
db_path: Path to the LanceDB database
deep: Use deep multi-agent QA for complex questions
Returns:
A FastA2A ASGI application
"""
if deep:
raise NotImplementedError("Deep QA agent not yet implemented for A2A")
from haiku.rag.qa.agent import Dependencies, QuestionAnswerAgent
# Create the agent (client will be provided per-task in custom worker)
@ -184,6 +177,7 @@ def create_qa_a2a_app(
raise
async def cancel_task(self, params: TaskIdParams) -> None:
"""Cancel a task - not implemented for this worker."""
pass
def build_message_history(self, history: list[Message]) -> list[Message]:
@ -249,19 +243,7 @@ def create_qa_a2a_app(
return FastA2A(
storage=storage,
broker=broker,
name="haiku-rag-qa",
description="Question answering agent powered by haiku.rag RAG system",
name="haiku-rag",
description="Conversational question answering agent powered by haiku.rag RAG system",
lifespan=lifespan,
)
def create_research_a2a_app(db_path: Path):
"""Create an A2A app for the research agent.
Args:
db_path: Path to the LanceDB database
Returns:
A FastA2A ASGI application
"""
raise NotImplementedError("Research agent not yet implemented for A2A")

View file

@ -384,11 +384,6 @@ def serve(
"--a2a",
help="Run A2A (Agent-to-Agent) server instead of MCP",
),
a2a_agent: str = typer.Option(
"qa",
"--a2a-agent",
help="Which agent to serve via A2A: 'qa', 'qa-deep', or 'research'",
),
a2a_host: str = typer.Option(
"127.0.0.1",
"--a2a-host",
@ -403,28 +398,15 @@ def serve(
"""Start the MCP or A2A server."""
if a2a:
try:
from haiku.rag.a2a import create_qa_a2a_app, create_research_a2a_app
from haiku.rag.a2a import create_a2a_app
except ImportError as e:
typer.echo(f"Error: {e}")
raise typer.Exit(1)
import uvicorn
if a2a_agent == "qa":
typer.echo(f"Starting QA agent A2A server on {a2a_host}:{a2a_port}")
app = create_qa_a2a_app(db_path=db, deep=False)
elif a2a_agent == "qa-deep":
typer.echo(f"Starting deep QA agent A2A server on {a2a_host}:{a2a_port}")
app = create_qa_a2a_app(db_path=db, deep=True)
elif a2a_agent == "research":
typer.echo(f"Starting research agent A2A server on {a2a_host}:{a2a_port}")
app = create_research_a2a_app(db_path=db)
else:
typer.echo(
f"Error: Unknown agent type '{a2a_agent}'. Use 'qa', 'qa-deep', or 'research'"
)
raise typer.Exit(1)
typer.echo(f"Starting A2A server on {a2a_host}:{a2a_port}")
app = create_a2a_app(db_path=db)
uvicorn.run(app, host=a2a_host, port=a2a_port)
else:
from haiku.rag.app import HaikuRAGApp