Introducing Any-Agent: An abstraction layer between your code and the many agentic frameworks
โข
1
None defined yet.
from any_agent import AnyAgent, AgentConfig
from any_agent.config import MCPStdioParams
agent = AnyAgent.create(
"tinyagent",
AgentConfig(
model_id="gpt-4.1-nano",
instructions="You must use the available tools to find an answer",
tools=[
MCPStdioParams(
command="uvx",
args=["duckduckgo-mcp-server"]
)
]
)
)
result = agent.run(
"Which Agent Framework is the best??"
)
print(result.final_output)
async
contexts:import asyncio
from any_agent import AgentConfig, AnyAgent, TracingConfig
from any_agent.tools import search_web
async def main():
agent = await AnyAgent.create_async(
"openai",
AgentConfig(
model_id="gpt-4.1-mini",
instructions="You are the main agent. Use the other available agents to find an answer",
),
managed_agents=[
AgentConfig(
name="search_web_agent",
description="An agent that can search the web",
model_id="gpt-4.1-nano",
tools=[search_web]
)
],
tracing=TracingConfig()
)
await agent.run_async("Which Agent Framework is the best??")
if __name__ == "__main__":
asyncio.run(main())
from any_agent import AgentConfig, AnyAgent
from any_agent.config import MCPSseParams
agent = AnyAgent.create(
"smolagents",
AgentConfig(
model_id="gpt-4o-mini",
tools=[
MCPSseParams(
url="http://localhost:8000/sse"
),
]
)
)
agent.run("What do MCP and SSE mean?")
langchain
and llama_index
, in addition to the other frameworks:from any_agent import AgentConfig, AgentFramework, AnyAgent
from any_agent.tracing import setup_tracing
framework = AgentFramework("langchain") # also in AgentFramework("llama_index") and the rest of frameworks
setup_tracing(framework)
agent = AnyAgent.create(
framework,
AgentConfig(
model_id="gpt-4.1-mini",
instructions="You are the main agent. Use the other available agents to find an answer",
),
managed_agents=[
AgentConfig(
name="search_web_agent",
description="An agent that can search the web",
model_id="gpt-4.1-nano",
tools=["any_agent.tools.search_web"]
),
AgentConfig(
name="visit_webpage_agent",
description="An agent that can visit webpages",
model_id="gpt-4.1-nano",
tools=["any_agent.tools.visit_webpage"]
)
]
)
agent.run("Which Agent Framework is the best??")
any-agent
library, now with support for the Agno agent framework. any-agent
๐ agent = AnyAgent.create(
AgentFramework("google"),
AgentConfig(
model_id="gpt-4o-mini"
)
)
agent.run("Which Agent Framework is the best??")
any-agent
. from any_agent import AgentConfig, AgentFramework, AnyAgent
agent = AnyAgent.create(
AgentFramework("smolagents"), # or openai, langchain, llama_index
AgentConfig(
model_id="gpt-4o-mini"
)
)
agent.run("Which Agent Framework is the best??")