Agent framework for Model Context Protocol (MCP) built on temporal
Project description
silsila (mcp-agent)
An agent framework built on MCP and Temporal for distributed AI applications
Introduction
This framework aims to make it straightforward to orchestrate complex AI workflows that rely on MCP (Model Context Protocol) servers for:
- Tools: Model-controlled functions like reading documents, calling APIs, or performing custom logic.
- Prompts: Templated interactions or question prompts exposed by servers.
- Memory: Persistent or semi-persistent data accessible through an MCP-compliant memory server.
- LLM Completions: Interfacing with large language models for planning or generating text.
We leverage Temporal to provide durable execution, parallelization, and the ability to pause or resume workflows. The code includes a developer-friendly dev mode for local iteration and a production path using Temporal for large-scale, resilient deployments.
Key Principles
-
MCP-First
All memory, prompts, tools, and even workflows are accessed via MCP calls. This ensures consistent usage patterns and the ability to switch underlying servers without changing workflow logic. -
Agents as Aggregators
Each Agent encapsulates multiple MCP servers and exposes typed methods for LLM completions, memory operations, and tool invocations. You never call raw MCP tools by name—instead, you invoke higher-level agent methods. Multiple agents can collaborate in a single workflow (e.g., one “planner” agent, one “worker” agent). -
Planner and Patterns
A Planner class handles LLM-driven decision-making (planning next actions). It returns structured directives (e.g., “Use tool X,” “Request human input,” “Done”). Common workflow patterns—like a “swarm” approach that repeatedly calls the planner—are encapsulated in base workflow classes such as SwarmWorkflowBase. -
Temporal Integration
By defining an OrchestratorInterface, the same workflows can run in dev mode (synchronously in your local environment) or production mode (as Temporal workflows). Human-in-the-loop signals and progress notifications are readily handled in both modes. -
Notifications and Human Input
Workflows can send progress or message notifications back to the upstream MCP client withnotifications/progressornotifications/message. They can also pause to wait for human input, which the user provides through an MCP tool call liketools/call(provide_human_input). -
Developer-Focused
The code aims to be readable and extensible, providing a straightforward mental model of how MCP orchestrations can be organized, tested, and extended for real-world AI pipelines.
High-Level Architecture
-
Agents (
MCPAggregator)- Wrap multiple MCP servers.
- Provide typed methods (e.g.,
agent.llm.complete_text()oragent.memory.get()).
-
Planner
- Uses an LLM-based approach to decide the next action.
- Returns a structured
Directivethat might say “use tool”, “request human input,” or “done.”
-
OrchestratorInterface
- Abstracts away the difference between dev (local) orchestration and production (Temporal) orchestration.
- Methods like
run_workflow(),send_message(),send_progress(), andwait_for_human_input()unify these environments.
-
Base Workflow Classes
- E.g.,
SwarmWorkflowBaseimplements a loop calling the Planner repeatedly, following the returned directives. - Developers can subclass to introduce domain-specific logic.
- E.g.,
-
MCP Server
- Optionally, this framework can itself be exposed as an MCP server, allowing upstream clients to call
tools/call(run_workflow)to start a workflow. - Human input is gathered by the upstream client calling
tools/call(provide_human_input)on the orchestrator server.
- Optionally, this framework can itself be exposed as an MCP server, allowing upstream clients to call
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file silsila-0.0.1.tar.gz.
File metadata
- Download URL: silsila-0.0.1.tar.gz
- Upload date:
- Size: 82.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abef11ba276963766ac32a1c57b289b29164ca79ef44c5aebd71c55091e6b5d6
|
|
| MD5 |
2c239d51155a989696d6021e1f5abf01
|
|
| BLAKE2b-256 |
1bb72f61546a3b1fcff473043f8f1ae90a8c7871ab09e2652a59b2bbb91c2d13
|
File details
Details for the file silsila-0.0.1-py3-none-any.whl.
File metadata
- Download URL: silsila-0.0.1-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c9cd64671d7e14503e20d5a23ecf06ac7add28db1c9bd16a4389732354b446d
|
|
| MD5 |
85794da8317bc99517d2fe564192d4ab
|
|
| BLAKE2b-256 |
5facfa56f03fa51f1ff0ab66382678ce8209b81ed1a7b20c14a0ab9443aac701
|