Skip to main content

A transparent, minimal, and hackable agent framework

Project description

AgentSilex

A transparent, minimal, and hackable agent framework for developers who want full control.

Why AgentSilex?

While large agent frameworks offer extensive features, they often become black boxes that are hard to understand, customize, or debug. AgentSilex takes a different approach:

  • Transparent: Every line of code is readable and understandable. No magic, no hidden complexity.
  • Minimal: Core implementation in ~300 lines. You can read the entire codebase in one sitting.
  • Hackable: Designed for modification. Fork it, customize it, make it yours.
  • Universal LLM Support: Built on LiteLLM, seamlessly switch between 100+ models - OpenAI, Anthropic, Google Gemini, DeepSeek, Azure, Mistral, local LLMs, and more. Change providers with one line of code.
  • Educational: Perfect for learning how agents actually work under the hood.

Who is this for?

  • Companies who need a customizable foundation for their agent systems
  • Developers who want to understand agent internals, not just use them
  • Educators teaching AI agent concepts
  • Researchers prototyping new agent architectures

Installation

pip install agentsilex

Or with uv:

uv add agentsilex

Quick Start

from agentsilex import Agent, Runner, Session, tool

# Define a simple tool
@tool
def get_weather(city: str) -> str:
    """Get weather information for a city."""
    # In production, this would call a real weather API
    return "SUNNY"

# Create an agent with the weather tool
agent = Agent(
    name="Weather Assistant",
    model="gemini/gemini-2.0-flash",  # Switch models: openai/gpt-4, anthropic/claude-3-5-sonnet, deepseek/deepseek-chat, et al.
    instructions="Help users find weather information using the available tools.",
    tools=[get_weather]
)

# Create a session to track conversation history
session = Session()

# Run the agent with a user query
runner = Runner(session)
result = runner.run(agent, "What's the weather in Monte Cristo?")

# Output the result
print("Final output:", result.final_output)

# Access the conversation history
for message in session.get_dialogs():
    print(message)

Multi-Agent Example

AgentSilex supports intelligent agent handoffs, allowing a main agent to route requests to specialized sub-agents:

from agentsilex import Agent, Runner, Session, tool

# Specialized weather agent with tools
@tool
def get_weather(city: str) -> str:
    """Get weather information for a city."""
    return "SUNNY"

weather_agent = Agent(
    name="Weather Agent",
    model="openai/gpt-4o-mini",
    instructions="Help users find weather information using tools",
    tools=[get_weather],
)

# Specialized FAQ agent
faq_agent = Agent(
    name="FAQ Agent",
    model="openai/gpt-4o-mini",
    instructions="Answer frequently asked questions about our products",
)

# Main orchestrator agent
main_agent = Agent(
    name="Main Agent",
    model="openai/gpt-4o-mini",
    instructions="Route user questions to the appropriate specialist agent",
    handoffs=[weather_agent, faq_agent],
)

# Execute multi-agent workflow
session = Session()
result = Runner(session).run(main_agent, "What's the weather in Paris?")
print(result.final_output)

Observability

AgentSilex includes built-in OpenTelemetry tracing to visualize agent execution, tool calls, and handoffs.

Quick Setup with Phoenix

# Install and start Phoenix
pip install arize-phoenix
python -m phoenix.server.main serve

# Set the endpoint
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"

# Run your agent - view traces at http://localhost:6006

Phoenix will show a complete trace tree of your agent workflow, including all tool calls and agent handoffs.

Features & Roadmap

✅ Implemented Features

Core Agent Capabilities

  • Single Agent Execution - Create and run individual agents with custom instructions
  • Tool Calling - Agents can call external tools/functions to perform actions
  • Tool Definition - Simple @tool decorator to define callable functions with automatic schema extraction
  • Conversation Management - Session-based dialog history tracking across multiple turns
  • Multi-Agent Handoff - Main agent can intelligently route requests to specialized sub-agents
  • Agents as Tools - Any agent can be converted into a tool for another agent with agent.as_tool()
  • Context Management - Share mutable state across tools and conversation turns

Technical Features

  • Universal LLM Support - Built on LiteLLM for seamless model switching (OpenAI, Anthropic, Google, DeepSeek, Azure, and 100+ models)
  • Type-Safe Tool Definitions - Automatic parameter schema extraction from Python type hints
  • Transparent Architecture - ~300 lines of readable, hackable code
  • Simple API - Intuitive Agent, Runner, Session, and @tool abstractions
  • OpenTelemetry Observability - Built-in tracing compatible with Phoenix and other OTLP backends

🚀 Roadmap

  • Streaming Support - Real-time response streaming for better UX
  • Async Support - Asynchronous execution for improved performance
  • Tool Call Error Handling - Graceful handling of failed tool executions
  • Parallel Tool Execution - Execute multiple tool calls concurrently
  • Agent Memory - Built-in memory management for long conversations
  • State Persistence - Save and restore agent sessions
  • Built-in Tools Library - Common tools (web search, file operations, etc.)
  • Custom Agent Behaviors - Pluggable behaviors (ReAct, Chain-of-Thought, etc.)
  • Human-in-the-Loop - Built-in approval flows for sensitive operations
  • Agent Evaluation Framework - Test and evaluate agent performance

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentsilex-0.6.tar.gz (244.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentsilex-0.6-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file agentsilex-0.6.tar.gz.

File metadata

  • Download URL: agentsilex-0.6.tar.gz
  • Upload date:
  • Size: 244.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentsilex-0.6.tar.gz
Algorithm Hash digest
SHA256 4d3214541f7a5f32819da911f514c591ceec0c9c2baa65c49384cc9d59cfc355
MD5 713a9f58e49339501691e41b2b79dcd8
BLAKE2b-256 9085a1923766a4e68975e6771b30e56defef7c01347dc8216c1c49d07aee9b1c

See more details on using hashes here.

File details

Details for the file agentsilex-0.6-py3-none-any.whl.

File metadata

  • Download URL: agentsilex-0.6-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentsilex-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 be73726c31fbd761e39c6611d13eeb933cc588361f8c5ff4d7b6eda56054c9bf
MD5 948e0410e2011055b8887f6bd3073e9c
BLAKE2b-256 a9453b1476c6a9bb8f2e4c72173b9e4ea90961565dfa95559e9a530934a9c2fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page