Remove alternative a2a options, there will only one
This commit is contained in:
parent
c7c3eaefe5
commit
e7451116d7
2 changed files with 8 additions and 44 deletions
|
|
@ -81,22 +81,15 @@ def a2a_to_pydantic_messages(a2a_messages: list[Message]) -> list[ModelMessage]:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def create_qa_a2a_app(
|
def create_a2a_app(db_path: Path):
|
||||||
db_path: Path,
|
"""Create an A2A app for the conversational QA agent.
|
||||||
deep: bool = False,
|
|
||||||
):
|
|
||||||
"""Create an A2A app for the QA agent.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
db_path: Path to the LanceDB database
|
db_path: Path to the LanceDB database
|
||||||
deep: Use deep multi-agent QA for complex questions
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A FastA2A ASGI application
|
A FastA2A ASGI application
|
||||||
"""
|
"""
|
||||||
if deep:
|
|
||||||
raise NotImplementedError("Deep QA agent not yet implemented for A2A")
|
|
||||||
|
|
||||||
from haiku.rag.qa.agent import Dependencies, QuestionAnswerAgent
|
from haiku.rag.qa.agent import Dependencies, QuestionAnswerAgent
|
||||||
|
|
||||||
# Create the agent (client will be provided per-task in custom worker)
|
# Create the agent (client will be provided per-task in custom worker)
|
||||||
|
|
@ -184,6 +177,7 @@ def create_qa_a2a_app(
|
||||||
raise
|
raise
|
||||||
|
|
||||||
async def cancel_task(self, params: TaskIdParams) -> None:
|
async def cancel_task(self, params: TaskIdParams) -> None:
|
||||||
|
"""Cancel a task - not implemented for this worker."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def build_message_history(self, history: list[Message]) -> list[Message]:
|
def build_message_history(self, history: list[Message]) -> list[Message]:
|
||||||
|
|
@ -249,19 +243,7 @@ def create_qa_a2a_app(
|
||||||
return FastA2A(
|
return FastA2A(
|
||||||
storage=storage,
|
storage=storage,
|
||||||
broker=broker,
|
broker=broker,
|
||||||
name="haiku-rag-qa",
|
name="haiku-rag",
|
||||||
description="Question answering agent powered by haiku.rag RAG system",
|
description="Conversational question answering agent powered by haiku.rag RAG system",
|
||||||
lifespan=lifespan,
|
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")
|
|
||||||
|
|
|
||||||
|
|
@ -384,11 +384,6 @@ def serve(
|
||||||
"--a2a",
|
"--a2a",
|
||||||
help="Run A2A (Agent-to-Agent) server instead of MCP",
|
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(
|
a2a_host: str = typer.Option(
|
||||||
"127.0.0.1",
|
"127.0.0.1",
|
||||||
"--a2a-host",
|
"--a2a-host",
|
||||||
|
|
@ -403,28 +398,15 @@ def serve(
|
||||||
"""Start the MCP or A2A server."""
|
"""Start the MCP or A2A server."""
|
||||||
if a2a:
|
if a2a:
|
||||||
try:
|
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:
|
except ImportError as e:
|
||||||
typer.echo(f"Error: {e}")
|
typer.echo(f"Error: {e}")
|
||||||
raise typer.Exit(1)
|
raise typer.Exit(1)
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
if a2a_agent == "qa":
|
typer.echo(f"Starting A2A server on {a2a_host}:{a2a_port}")
|
||||||
typer.echo(f"Starting QA agent A2A server on {a2a_host}:{a2a_port}")
|
app = create_a2a_app(db_path=db)
|
||||||
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)
|
|
||||||
|
|
||||||
uvicorn.run(app, host=a2a_host, port=a2a_port)
|
uvicorn.run(app, host=a2a_host, port=a2a_port)
|
||||||
else:
|
else:
|
||||||
from haiku.rag.app import HaikuRAGApp
|
from haiku.rag.app import HaikuRAGApp
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue