Cognitive Architectures for Multi-Agent Teams
Cognitive Architectures for Multi-Agent Teams.
Mainframe-Orchestra is a lightweight, open-source agentic framework for building LLM-based pipelines and multi-agent teams. It implements a unique approach to agent orchestration that goes beyond simple routing, enabling complex workflows.
Install Orchestra using pip:
pip install mainframe-orchestraHere's a simple example to get you started:
from mainframe_orchestra import Agent, Task, OpenaiModels, WebTools, set_verbosity
set_verbosity(1)
research_agent = Agent(
agent_id="research_assistant_1",
role="research assistant",
goal="answer user queries",
llm=OpenaiModels.gpt_4_1,
tools={WebTools.exa_search}
)
def research_task(topic):
return Task.create(
agent=research_agent,
instruction=f"Use your exa search tool to research {topic} and explain it in a way that is easy to understand.",
)
result = research_task("quantum computing")
print(result)pip install yfinance or use alternative financial data providersTask.create_async() instead of Task.create().create() to .create_async()# Before
async def my_task():
result = await Task.create(agent=agent, instruction="...")
# After
async def my_task():
result = await Task.create_async(agent=agent, instruction="...")Tasks: Discrete units of work
Agents: Personas that perform tasks and can be assigned tools
Tools: Wrappers around external services or specific functionalities
Language Model Interfaces: Consistent interface for various LLM providers
Orchestra uses LiteLLM to support a wide range of language models from multiple providers:
GPT-4.1, o3, GPT-4o, GPT-4o Mini, & Custom defined models
Orchestra supports customizing the OpenAI base URL, allowing you to connect to OpenAI-compatible APIs or proxies:
# Method 1: Set via environment variable
import os
os.environ["OPENAI_BASE_URL"] = "https://your-custom-endpoint.com/v1"
# Method 2: Set globally for all OpenAI requests
from mainframe_orchestra.llm import OpenaiModels
OpenaiModels.set_base_url("https://your-custom-endpoint.com/v1")
# Method 3: Set for a specific request
response, error = await OpenaiModels.gpt_4_1(
messages=[{"role": "user", "content": "Hello"}],
base_url="https://your-custom-endpoint.com/v1"
)Claude 3 Haiku, Claude 3 Sonnet, Claude 3 Opus, Claude 3.5 Sonnet, Claude 3.7 Sonnet, & Custom defined models
GPT-4 Turbo, Claude 3 Opus, Mixtral 8x7B, Llama 3.1 405B, & Custom defined models
Mistral, Mixtral, Llama 3.1, Qwen, Gemma, & Custom defined models
Mixtral 8x7B, Llama 3, Llama 3.1, Gemma, & Custom defined models
Custom defined models
Gemini 1.5 Flash, Gemini 1.5 Flash 8B, Gemini 1.5 Pro, & Custom defined models
Deepseek Reasoner, Deepseek Chat, & Custom defined models
Each provider is accessible through a dedicated class (e.g., OpenaiModels, AnthropicModels, etc.) with methods corresponding to specific models. This structure allows for switching between models and providers, enabling users to leverage the most suitable LLM for their tasks.
Mainframe-Orchestra comes with a comprehensive set of built-in tools that provide various functionalities for your agents. Here's an overview of the available tool categories:
Note:
YahooFinanceToolswas deprecated in v1.0.0 due to upstream API instability. For financial data, consider usingFredToolsfor economic data or web tools.
Mainframe-Orchestra supports creating custom tools to extend functionality beyond the built-in tools. Custom tools can be implemented either as static methods or as class instance methods for more complex operations. Here's a basic example:
…Tools can be assigned to agents during initialization:
agent = Agent(
agent_id="my_agent",
tools={NumpyTools.array_mean, WebTools.exa_search}
)For detailed documentation on creating custom tools, including best practices for error handling and API integration, visit our Custom Tools Documentation.
Mainframe-Orchestra allows you to create multi-agent teams that can use tools to complete a series of tasks. Here's an example of a GitHub/Linear integration team that automatically manages issue tracking:
…Note: this example requires GitHub and Linear API keys to be set in your environment variables.
The Conduct and Compose tools are used to orchestrate and compose agents. Conduct is used to actually instruct and orchestrate a team of agents, while Compose is used in addition to the Conduct tool to enrich the orchestration process with additional complexity as a preprocessing step. It's important to note that Conduct is required for the orchestration process to work, while Compose is an optional additional tool that can be used to enrich the orchestration process.
By combining agents, tasks, tools, and language models, you can create a wide range of workflows, from simple pipelines to complex multi-agent teams.
For documentation on MCP integration, visit our MCP Integration Guide.
Orchestra supports streaming of LLM responses. When using streaming, you need to use an async approach:
…The key points for streaming:
stream=True in the Task.create callasync for to process the streaming chunksFor more detailed information, tutorials, and advanced usage, visit our documentation.
Mainframe-Orchestra depends on and welcomes community contributions! Please review contribution guidelines and submit a pull request if you'd like to contribute.
Mainframe-Orchestra is released under the Apache License 2.0. See the LICENSE file for details.
Orchestra is a fork and further development of TaskflowAI.
For issues or questions, please file an issue on our GitHub repository issues page.
⭐️ If you find Mainframe-Orchestra helpful, consider giving it a star!
Happy building!
No open issues yet, or sync has not completed.