An execution module carries out the current plan step by calling available tools, then writes the result back to a shared workspace. Like a ReAct agent, it acts on a sub-goal; unlike a bare tool call, it records evidence for later evaluation. section 10.2.5 section 10.2.1
Treat the module as a small, inspectable pipeline:
- Read the current plan step or sub-goal from the workspace. section 10.2.5
- Call a suitable tool through an MCP server or internal function. section 10.2.5
- Wrap the raw result as a finding containing content, source, relevance score, and quality note. section 10.2.5
- Return the finding to the workspace so the evaluation module can judge progress and confidence. section 10.2.5 section 10.2.1
Testing competing troubleshooting hypotheses
A plan asks the executor to investigate connection-pool exhaustion. It searches documentation, returns a relevance score of 0.8 with a quality note identifying official, directly relevant content, and lets evaluation increase confidence. A weaker community-blog result receives a 0.5 score and a partial-relevance note. section 10.3.3
Listing 10.4 04_execution_module.py
from agents import Agent, function_tool
from agents.mcp import MCPServerStdio
# Connect to domain-specific tools via MCP
search_server = MCPServerStdio(
command="npx",
args=["-y", "@modelcontextprotocol/server-filesystem", "./docs"] #1
)
execution_agent = Agent(
name="Executor",
instructions="""You are the execution module of a cognitive agent.
You receive a specific sub-goal from the current plan and execute
it using available tools.
For each result, provide:
- content: The relevant information you found
- source: Where it came from
- relevance_score: 0.0 to 1.0, how relevant to the sub-goal
- quality_note: Any concerns about the result quality
(e.g., "source is a table of contents, not actual content",
"result is partial", "high confidence match")
Be honest about quality. A retrieval that returns metadata
instead of content should get a low relevance_score and a
quality_note explaining why.""",
mcp_servers=[search_server],
output_type=Finding,
)
Inspect a minimal filesystem-search implementation using an MCP server and an execution agent instructed to emit structured findings. section 10.2.5
