MCPcopy Index your code
hub / github.com/TesslateAI/TFrameX

github.com/TesslateAI/TFrameX @v1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.0 ↗ · + Follow
1,593 symbols 6,039 edges 116 files 1,236 documented · 78%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TFrameX v1.1.0: The Enterprise-Ready Multi-Agent LLM Orchestration Framework 🚀

image

Please join our discord for support: Discord

TframeX Documentation Website

PyPI version

License: MIT

TFrameX empowers you to build sophisticated, multi-agent LLM applications with unparalleled ease and flexibility. Move beyond simple prompt-response interactions and construct complex, dynamic workflows where intelligent agents collaborate, use tools, and adapt to intricate tasks.

🔥 What's NEW in v1.1.0: Enterprise-Grade Power!

🌊 Revolutionary Streaming Support

  • Real-Time Agent Responses: Experience blazing-fast streaming responses from all agents
  • Live Flow Execution: Watch your multi-agent workflows execute in real-time
  • Seamless Integration: Zero configuration change needed - just add streaming=True

🔌 Next-Level MCP Integration

  • Universal Tool Connectivity: Connect to any MCP-compatible service with zero friction
  • Enhanced Stability: Rock-solid MCP server management with auto-reconnection
  • Rich Meta-Tools: Built-in tools for server discovery, resource exploration, and dynamic prompt usage
  • Production Ready: Battle-tested MCP integration for enterprise deployments

🏢 Enterprise-Grade Features

  • 🔒 Enterprise Security: Full RBAC, multi-auth (JWT, OAuth2, API keys), audit logging, and session management
  • 📊 Advanced Monitoring: Prometheus, OpenTelemetry, and custom metrics with real-time dashboards
  • 🗄️ Multi-Backend Storage: SQLite → PostgreSQL → S3 with seamless auto-migration
  • ⚡ Production Performance: Optimized for high-throughput, multi-tenant deployments
  • 🛡️ Compliance Ready: Complete audit trails, data governance, and regulatory compliance features

Perfect for production deployments, enterprise applications, and mission-critical AI systems!

Find our Agent Builder Framework Here: Tesslate Studio Agent Builder

image


✨ Why TFrameX?

  • 🧠 Intelligent Agents, Simplified: Define specialized agents with unique system prompts, tools, and even dedicated LLM models.

  • 🛠️ Seamless Tool Integration: Equip your agents with custom tools using a simple decorator. Let them interact with APIs, databases, or any Python function.

  • 🌊 Powerful Flow Orchestration: Design complex workflows by chaining agents and predefined patterns (Sequential, Parallel, Router, Discussion) using an intuitive Flow API.

  • Lightning-Fast Streaming: Experience real-time agent responses with our revolutionary streaming support - just add streaming=True for instant responsiveness.

  • 🔌 Universal MCP Connectivity: Connect to any MCP-compatible service with zero friction - from file systems to databases to external APIs.

  • 🧩 Composable & Modular: Build reusable components (agents, tools, flows) that can be combined to create increasingly complex applications.

  • 🚀 Agent-as-Tool Paradigm: Elevate your architecture by enabling agents to call other agents as tools, creating hierarchical and supervised agent structures.

  • 🏢 Enterprise-Ready: Full RBAC, authentication, audit logging, metrics collection, and multi-backend storage for production deployments.

  • 🎨 Fine-Grained Control: Customize agent behavior with features like per-agent LLMs and <think> tag stripping for cleaner outputs.

  • 💬 Interactive Debugging: Quickly test your flows and agents with the built-in interactive chat.

  • 🔌 Pluggable LLMs: Start with OpenAIChatLLM (compatible with OpenAI API and many local server UIs like Ollama) and extend to other models easily.

  • CLI Tooling: Complete command-line interface with tframex basic for instant interaction, tframex setup for project scaffolding, and tframex serve for web interfaces.


💡 Core Concepts

TframeX Documentation Website

TFrameX is designed to orchestrate complex agent interactions using its powerful Flow system, which controls the sequence and logic of operations.

Within a Flow, you define reusable collaboration structures called Patterns—such as SequentialPattern, RouterPattern, or DiscussionPattern. These patterns can be nested inside one another. For example, a ParallelPattern may contain several SequentialPatterns, enabling hierarchical task breakdowns.

TFrameX also supports the agent-as-tool paradigm: LLMAgents can directly call other registered agents. This enables supervisor-worker relationships and task delegation between agents.

Together, nested patterns and inter-agent calling allow for sophisticated designs—including recursive or cyclical flows. For example, a DiscussionPattern creates a controlled loop of interaction. However, to avoid infinite loops, flows must be carefully structured with clear termination conditions or managed by moderator agents.

These entire Flows—along with their patterns and agent configurations—can be defined declaratively in YAML files. This makes it easy to version, share, and modify agent behaviors programmatically, giving you maximum flexibility in building adaptive, interconnected agent systems.

TFrameX revolves around a few key concepts:

  1. 🌟 Agents (BaseAgent, LLMAgent, ToolAgent):

  2. The core actors in your system.

  3. LLMAgent: Leverages an LLM to reason, respond, and decide when to use tools or call other agents.

  4. ToolAgent: A stateless agent that directly executes a specific tool (useful for simpler, direct tool invocations within a flow).

  5. Can have their own memory, system prompts, and a dedicated LLM instance.

  6. Support for strip_think_tags: Automatically remove internal "thinking" steps (e.g., <think>...</think>) from the final output for cleaner user-facing responses.

  7. 🔧 Tools (@app.tool):

  8. Python functions (sync or async) that agents can call to perform actions or retrieve information from the outside world (APIs, databases, file systems, etc.).

  9. Schemas are automatically inferred from type hints or can be explicitly defined.

  10. 🌊 Flows (Flow):

  11. Define the sequence or graph of operations.

  12. A flow consists of steps, where each step can be an agent or a Pattern.

  13. Orchestrate how data (as Message objects) and control pass between agents.

  14. 🧩 Patterns (SequentialPattern, ParallelPattern, RouterPattern, DiscussionPattern):

  15. Reusable templates for common multi-agent interaction structures:

  16. SequentialPattern: Executes a series of agents/patterns one after another.

  17. ParallelPattern: Executes multiple agents/patterns concurrently on the same input.

  18. RouterPattern: Uses a "router" agent to decide which subsequent agent/pattern to execute.

  19. DiscussionPattern: Facilitates a multi-round discussion between several agents, optionally moderated.

  20. 🤝 Agent-as-Tool (Supervisor Agents):

  21. A powerful feature where one LLMAgent can be configured to call other registered agents as if they were tools. This allows for creating supervisor agents that delegate tasks to specialized sub-agents.

  22. 🤖 LLMs (BaseLLMWrapper, OpenAIChatLLM):

  23. Pluggable wrappers for LLM APIs. OpenAIChatLLM provides out-of-the-box support for OpenAI-compatible APIs (including many local model servers like Ollama or LiteLLM).

  24. Agents can use a default LLM provided by the app, or have a specific LLM instance assigned for specialized tasks.

  25. 💾 Memory (InMemoryMemoryStore):

  26. Provides agents with conversation history. InMemoryMemoryStore is available by default, and you can implement custom stores by inheriting from BaseMemoryStore.

Getting Started

🚀 Quick Start with CLI

The fastest way to get started with TFrameX is using the built-in CLI:

  1. Install TFrameX: bash pip install tframex

  2. Start an interactive session: ```bash # Set your API key export OPENAI_API_KEY="sk-..."

# Launch interactive chat tframex basic ```

  1. Create your first project: ```bash # Generate a complete project structure tframex setup my-ai-app cd my-ai-app

# Configure environment cp .env.example .env # Edit .env with your API keys

# Install dependencies and run pip install -r requirements.txt python main.py ```

  1. Try the web interface: ```bash # Install web dependencies pip install tframex[web]

# Launch web server tframex serve # Open http://localhost:8000 in your browser ```

📚 CLI Commands

  • tframex basic - Interactive AI session with built-in tools
  • tframex setup <project> - Complete project scaffolding
  • tframex serve - Web interface for agent interaction

For complete CLI documentation, see CLI Guide and CLI Reference.

📦 Manual Installation

To use TFrameX in your project manually, install it via pip:

pip install tframex

Core dependencies (like httpx, pydantic, PyYAML, python-dotenv, openai) are listed in pyproject.toml and should be installed automatically. If you plan to run specific examples from the TFrameX repository, you might need additional packages like aiohttp (for the Reddit tool example) or Flask (for the web app example). You can install these separately: pip install aiohttp Flask.

**For Developers (Contributing to TFrameX or running all examples from source):**

If you're developing TFrameX itself or want to run examples directly from a cloned repository, we recommend setting up a dedicated virtual environment. You can use [`uv`](https://github.com/astral-sh/uv) for its speed, or `pip` with `venv`.

**Setting up with `uv` (Recommended):**
First, install `uv` by following the instructions at [astral.sh/uv](https://astral.sh/uv).
Then, in your cloned TFrameX repository:
```bash
# Clone the repository (if you haven't already)
# git clone https://github.com/TesslateAI/TFrameX.git
# cd TFrameX

# Create and activate a virtual environment
uv venv
source .venv/bin/activate  # On macOS/Linux
# For Windows PowerShell: .venv\Scripts\Activate.ps1

# Install TFrameX in editable mode with optional dependencies
# For core development and running most examples:
uv pip install -e ".[examples]"
# To include development tools (linters, formatters):
# uv pip install -e ".[examples,dev]"
```
This approach uses the `pyproject.toml` file for precise dependency management.

**Setting up with `pip` and `venv` (Alternative):**
In your cloned TFrameX repository:
```bash
# Clone the repository (if you haven't already)
# git clone https://github.com/TesslateAI/TFrameX.git
# cd TFrameX

# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate  # On macOS/Linux
# For Windows Command Prompt: .venv\Scripts\activate.bat

# Install TFrameX in editable mode with optional dependencies
# For core development and running most examples:
pip install -e ".[examples]"
# To include development tools:
# pip install -e ".[examples,dev]"
```
  1. Set up your LLM Environment: Ensure your environment variables for your LLM API are set (e.g., OPENAI_API_KEY, OPENAI_API_BASE). Create a .env file in your project root (TFrameX uses python-dotenv to load this): ```env # Example for Ollama (running locally) OPENAI_API_BASE="http://localhost:11434/v1" OPENAI_API_KEY="ollama" # Placeholder, as Ollama doesn't require a key by default OPENAI_MODEL_NAME="llama3" # Or your preferred model served by Ollama

    Example for OpenAI API

    OPENAI_API_KEY="your_openai_api_key"

    OPENAI_MODEL_NAME="gpt-3.5-turbo"

    OPENAI_API_BASE="https://api.openai.com/v1" # (Usually default if not set)

    ```

  2. Your First TFrameX App:

```python import asyncio import os from dotenv import load_dotenv from tframex import TFrameXApp, OpenAIChatLLM, Message

load_dotenv() # Load .env file

1. Configure your LLM

TFrameX will use environment variables for OPENAI_API_BASE, OPENAI_API_KEY, OPENAI_MODEL_NAME by default if available

You can explicitly pass them too:

my_llm = OpenAIChatLLM( model_name=os.getenv("OPENAI_MODEL_NAME", "gpt-3.5-turbo"), api_base_url=os.getenv("OPENAI_API_BASE"), # Can be http://localhost:11434/v1 for Ollama api_key=os.getenv("OPENAI_API_KEY") # Can be "ollama" for Ollama )

2. Initialize TFrameXApp

app = TFrameXApp(default_llm=my_llm)

3. Define a simple agent

@app.agent( name="GreeterAgent", system_prompt="You are a friendly greeter. Greet the user and mention their name: {user_name}." ) async def greeter_agent_func(): # The function body can be pass; TFrameX handles logic for LLMAgent pass

4. Run the agent

async def main(): async with app.run_context() as rt: # Creates a runtime context user_input = Message(role="user", content="Hello there!")

    response = await rt.call_agent(
        "GreeterAgent",
        user_input,

        # You can pass template variables to the system prompt

        template_vars={"user_name": "Alex"}
    )

    print(f"GreeterAgent says: {response.content}")

if name == "main": # Basic check for LLM configuration if not my_llm.api_base_url: print(

Core symbols most depended-on inside this repo

call_agent
called by 102
tframex/util/engine.py
run_context
called by 101
tframex/app.py
add_step
called by 81
tframex/flows/flows.py
_key
called by 56
tframex/enterprise/storage/redis.py
execute
called by 49
tframex/util/tools.py
run
called by 42
tframex/agents/base.py
close
called by 41
tframex/util/llms.py
select
called by 37
tframex/enterprise/storage/s3.py

Shape

Method 932
Function 371
Class 223
Route 67

Languages

Python100%

Modules by API surface

tframex/enterprise/security/session.py51 symbols
tframex/enterprise/security/rbac.py43 symbols
tframex/enterprise/security/auth.py41 symbols
tests/test_streaming.py41 symbols
tframex/enterprise/storage/redis.py37 symbols
examples/03-integration-examples/enterprise-hitl-workflow/main.py37 symbols
tframex/enterprise/metrics/custom.py36 symbols
tframex/mcp/notifications.py34 symbols
tframex/enterprise/security/middleware.py34 symbols
tframex/enterprise/app.py34 symbols
tframex/enterprise/security/audit.py32 symbols
tests/comprehensive_streaming_test.py31 symbols

Datastores touched

dbDatabase · 1 repos
mydbDatabase · 1 repos
dbnameDatabase · 1 repos
tframexDatabase · 1 repos

For agents

$ claude mcp add TFrameX \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact