






















agno 通过agentos 可以快速将各种agno 的能力暴露为服务方便使用,但是有时我们可能会有不少agentos 服务,gateway 模式就是一种聚合组合能力,可以将多个agentos 的资源再组合,实现更加强大的agent 能力
from agno.agent import Agent, RemoteAgent
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS
from agno.db.postgres import PostgresDb
db = PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai")
# Local agent
local_agent = Agent(
name="Q&A Agent",
id="question-answer-agent",
model=OpenAIResponses(id="gpt-5.2"),
instructions="You are a helpful question and answer assistant.",
db=db,
)
# Remote agents from other servers
remote_assistant = RemoteAgent(
base_url="http://assistant-server:7778",
agent_id="assistant-agent",
)
remote_researcher = RemoteAgent(
base_url="http://research-server:7778",
agent_id="researcher-agent",
)
# Gateway combining both
gateway = AgentOS(
id="hybrid-gateway",
agents=[local_agent, remote_assistant, remote_researcher],
)
app = gateway.get_app()
if __name__ == "__main__":
gateway.serve(app="gateway:app", port=7777)
ango 的gateway 模式很有意思,而且机制很大,对于自己开发agent 也是很值得学习的思路
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。