-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an endpoint for service metadata and use it to configure the app (#…
…116) * Define types and lay the groundwork for service metadata * Fix bug with settings active_keys being unordered * Add /info endpoint for ServiceMetadata * Add client support for /info endpoint * Update app to use metadata endpoint for dynamic settings * Introduce AgentClientError and clean up agent error handling * Update app error handling * Add an integration test with streamlit app * Update README.md
- Loading branch information
1 parent
1814647
commit 198b878
Showing
21 changed files
with
538 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from agents.agents import DEFAULT_AGENT, agents | ||
from agents.agents import DEFAULT_AGENT, get_agent, get_all_agent_info | ||
|
||
__all__ = ["agents", "DEFAULT_AGENT"] | ||
__all__ = ["get_agent", "get_all_agent_info", "DEFAULT_AGENT"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
from dataclasses import dataclass | ||
|
||
from langgraph.graph.state import CompiledStateGraph | ||
|
||
from agents.bg_task_agent.bg_task_agent import bg_task_agent | ||
from agents.chatbot import chatbot | ||
from agents.research_assistant import research_assistant | ||
from schema import AgentInfo | ||
|
||
DEFAULT_AGENT = "research-assistant" | ||
|
||
|
||
agents: dict[str, CompiledStateGraph] = { | ||
"chatbot": chatbot, | ||
"research-assistant": research_assistant, | ||
"bg-task-agent": bg_task_agent, | ||
@dataclass | ||
class Agent: | ||
description: str | ||
graph: CompiledStateGraph | ||
|
||
|
||
agents: dict[str, Agent] = { | ||
"chatbot": Agent(description="A simple chatbot.", graph=chatbot), | ||
"research-assistant": Agent( | ||
description="A research assistant with web search and calculator.", graph=research_assistant | ||
), | ||
"bg-task-agent": Agent(description="A background task agent.", graph=bg_task_agent), | ||
} | ||
|
||
|
||
def get_agent(agent_id: str) -> CompiledStateGraph: | ||
return agents[agent_id].graph | ||
|
||
|
||
def get_all_agent_info() -> list[AgentInfo]: | ||
return [ | ||
AgentInfo(key=agent_id, description=agent.description) for agent_id, agent in agents.items() | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from client.client import AgentClient | ||
from client.client import AgentClient, AgentClientError | ||
|
||
__all__ = ["AgentClient"] | ||
__all__ = ["AgentClient", "AgentClientError"] |
Oops, something went wrong.