Skip to content

Commit edaecd4

Browse files
committed
[Temporal - Documentation] Removed code execution
1 parent 944606c commit edaecd4

File tree

1 file changed

+5
-14
lines changed
  • examples/pydantic_ai_examples/temporal_streaming

1 file changed

+5
-14
lines changed

examples/pydantic_ai_examples/temporal_streaming/agents.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66

77
from datetime import timedelta
88

9-
from mcp_run_python import code_sandbox
10-
from pydantic_ai import Agent, FilteredToolset, ModelSettings, RunContext
11-
from pydantic_ai.durable_exec.temporal import TemporalAgent
12-
from pydantic_ai.mcp import MCPServerStdio
13-
from pydantic_ai.models.anthropic import AnthropicModel
14-
from pydantic_ai.providers.anthropic import AnthropicProvider
159
from temporalio.common import RetryPolicy
1610
from temporalio.workflow import ActivityConfig
1711

1812
from datamodels import AgentDependencies
13+
from pydantic_ai import Agent, FilteredToolset, ModelSettings
14+
from pydantic_ai.durable_exec.temporal import TemporalAgent
15+
from pydantic_ai.mcp import MCPServerStdio
16+
from pydantic_ai.models.anthropic import AnthropicModel
17+
from pydantic_ai.providers.anthropic import AnthropicProvider
1918

2019

2120
async def get_mcp_toolsets() -> dict[str, FilteredToolset]:
@@ -78,7 +77,6 @@ async def build_agent(stream_handler=None, **env_vars):
7877
"""
7978
system_prompt = """
8079
You are an expert financial analyst that knows how to search for financial data on the web.
81-
You also have a Data Analyst background, mastering well how to use pandas for tabular operations.
8280
"""
8381
agent_name = 'YahooFinanceSearchAgent'
8482

@@ -92,13 +90,6 @@ async def build_agent(stream_handler=None, **env_vars):
9290
deps_type=AgentDependencies,
9391
)
9492

95-
@agent.tool(name='run_python_code')
96-
async def run_python_code(ctx: RunContext[None], code: str) -> str:
97-
"""Execute Python code in a sandboxed environment with pandas and numpy available."""
98-
async with code_sandbox(dependencies=['pandas', 'numpy']) as sandbox:
99-
result = await sandbox.eval(code)
100-
return result
101-
10293
temporal_agent = TemporalAgent(
10394
wrapped=agent,
10495
model_activity_config=ActivityConfig(

0 commit comments

Comments
 (0)