Skip to content

openai-agents hierarchical agent orchestration with session encryption and distributed hosting support.

Notifications You must be signed in to change notification settings

maxmekiska/agent-trees

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agent Trees

Hierarchical agent orchestration with session encryption and distributed support. Agents call other agents as tools, forming execution trees.

The following shows an example agent workflow, which should be easily adaptable to other use cases. More complex workflows can be created by increasing the depth of the agent tree. It is generally recommended to increase depth rather than breadth to avoid overwhelming models with too many tools. Note that not all tools need to be agents.

Architecture

graph TD
    User[User Request] --> API[FastAPI Endpoint]
    API --> Session[Session Manager]
    
    Session --> EncryptLayer[Encrypted Session<br/>Fernet + HKDF]
    EncryptLayer --> SQLite[(SQLite<br/>Local Storage)]
    EncryptLayer --> Postgres[(PostgreSQL<br/>Distributed)]
    
    Session --> Orch[Orchestrator Agent<br/>Claude 3.5 Sonnet]
    
    Orch --> Tool1[translate_to_spanish<br/>Tool Function]
    Orch --> Tool2[translate_to_french<br/>Tool Function]
    Orch --> Tool3[translate_to_italian<br/>Tool Function]
    Orch --> Search[web_search<br/>Tavily API]

    Tool1 --> Spanish[Spanish Agent<br/>GPT-4o-mini]
    Tool2 --> French[French Agent<br/>GPT-4o-mini]
    Tool3 --> Italian[Italian Agent<br/>GPT-4o-mini]

    Italian --> Tool4[get_travel_advise<br/>Tool Function]

    
    Spanish --> Weather[get_weather_forecast<br/>Tool Function]
    Tool4 --> Travel[Italian Travel Agent<br/>Llama 3.1]
Loading

Features

  • Agent Trees: Agents wrapped as async tools, enabling nested agent calls
  • Session Encryption: Fernet encryption with per-session derived keys and TTL
  • Distributed Mode: PostgreSQL backend for multi-instance deployments
  • Model Flexibility: Mix models from different providers (OpenRouter compatible)
  • Web Search: Integrated Tavily search for real-time information
  • FastAPI: Production-ready REST endpoints with health checks

Configuration

Key environment variables:

  • KEY: OpenRouter API key
  • ENCRYPTION_KEY: Fernet key for session encryption
  • USE_DISTRIBUTED: Enable PostgreSQL backend
  • DATABASE_URL: PostgreSQL connection string
  • LOG_LEVEL: Control logging verbosity

See .env.example for all options.

About

openai-agents hierarchical agent orchestration with session encryption and distributed hosting support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages