Skip to main content

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

  1. 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.

  2. 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).

  3. 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.

  4. 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.

  5. Notifications and Human Input
    Workflows can send progress or message notifications back to the upstream MCP client with notifications/progress or notifications/message. They can also pause to wait for human input, which the user provides through an MCP tool call like tools/call(provide_human_input).

  6. 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

  1. Agents (MCPAggregator)

    • Wrap multiple MCP servers.
    • Provide typed methods (e.g., agent.llm.complete_text() or agent.memory.get()).
  2. Planner

    • Uses an LLM-based approach to decide the next action.
    • Returns a structured Directive that might say “use tool”, “request human input,” or “done.”
  3. OrchestratorInterface

    • Abstracts away the difference between dev (local) orchestration and production (Temporal) orchestration.
    • Methods like run_workflow(), send_message(), send_progress(), and wait_for_human_input() unify these environments.
  4. Base Workflow Classes

    • E.g., SwarmWorkflowBase implements a loop calling the Planner repeatedly, following the returned directives.
    • Developers can subclass to introduce domain-specific logic.
  5. 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.

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

silsila-0.0.1.tar.gz (82.1 kB view details)

Uploaded Source

Built Distribution

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

silsila-0.0.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

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

Hashes for silsila-0.0.1.tar.gz
Algorithm Hash digest
SHA256 abef11ba276963766ac32a1c57b289b29164ca79ef44c5aebd71c55091e6b5d6
MD5 2c239d51155a989696d6021e1f5abf01
BLAKE2b-256 1bb72f61546a3b1fcff473043f8f1ae90a8c7871ab09e2652a59b2bbb91c2d13

See more details on using hashes here.

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

Hashes for silsila-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c9cd64671d7e14503e20d5a23ecf06ac7add28db1c9bd16a4389732354b446d
MD5 85794da8317bc99517d2fe564192d4ab
BLAKE2b-256 5facfa56f03fa51f1ff0ab66382678ce8209b81ed1a7b20c14a0ab9443aac701

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