Examples showing agents analyzing data and doing consensus to review and approve proposals - in this case, Cosmos Insurance proposals. These agents are automation agents who accomplish tasks intelligently and independently. They are not conversational. These agents are exposed as tools (via MCP) so they can be used by an MCP client.
We will demonstrate several kinds of agents:
- local agents that strips sensitive data?
- analysis agents that review proposals for acceptance based on insurance rules
- these are evaluated which weighs their judgements
- consensus agent that reviews analysis and comes to a final result
- summary agent that summarizes the review and analysis
- Python3+
uv(curl -LsSf https://astral.sh/uv/install.sh | sh)- Temporal Local Setup Guide
- Claude for Desktop, Goose, or maybe mcp inspector
uv venv
source .venv/bin/activate
poetry install(if using local Temporal, see .env.example for other options)
temporal server start-devCopy .env.example to .env and set your properties, particularly:
LLM_MODEL=openai/gpt-4o
LLM_KEY=sk-proj-...poetry run python run_worker.pypoetry run python run_analysis.py # defaults to bebopOr pass a proposal name in:
poetry run python run_analysis.py serenityThis agent is:
- a tool that takes action for an agent in MCP context
- an agent that makes decisions - to approve or reject the proposals
- an orchestrator of the consensus agents
- a Temporal Workflow - dynamically taking action to accomplish the review analysis
Note: It does create reviews.json and creates a review.pdf
An easy way to understand what it's doing is to kick it off via a terminal:
poetry run python run_consensus_agent.py Here's what the output looks like:
You can follow along with its progress in the Temporal UI Workflow History.
You can also hook this up to an MCP Client using the included mcp_server.py.
(You may want to reset the data files between runs to get the same results again.)
WSL config:
"analysis_agent": {
"disabled": false,
"timeout": 60,
"type": "stdio",
"command": "wsl.exe",
"args": [
"--cd",
"/path/to/temporal-multi-agent-consensus-approval-analysis",
"--",
"poetry",
"run",
"python",
"mcp_server.py"
]
}Building agents is easy and straightforward with Temporal. Temporal features like Workflows, Activities, and Signals, plus durable state management and retries, dramatically simplify building out agentic systems. Plus, because Temporal Cloud can scale to extremely high volumes, our agent application is also scalable to high volumes easily, by scaling up our workers (and paying for LLM API Keys with high rate limits, ha).
Consensus is useful for important processes that you want to automate but not leave to only one agent.
If you already know how to build with Temporal, you have a head start on building some agentic systems. If not, play with the code, take some (free) courses, and enjoy learning.