From c4eb44e67daaed7b6e551a66a148c95d8b9c8107 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Sat, 19 Apr 2025 08:57:12 +0000 Subject: [PATCH] fix(agent): standardize agent initialization to match example pattern --- examples/mcp_example/mock_math_server.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/examples/mcp_example/mock_math_server.py b/examples/mcp_example/mock_math_server.py index e49368a2..bba9a01d 100644 --- a/examples/mcp_example/mock_math_server.py +++ b/examples/mcp_example/mock_math_server.py @@ -42,4 +42,24 @@ def divide(a: int, b: int) -> float: if __name__ == "__main__": print("Starting Mock Math Server on port 8000...") + # Initialize connection params + server_params = MCPServerSseParams( + url="http://0.0.0.0:8000/mcp", + headers={"Content-Type": "application/json"}, + timeout=5.0, + sse_read_timeout=30.0 + ) + + # Initialize the agent + agent = Agent( + agent_name="Math-Processing-Agent", + agent_description="Specialized agent for mathematical operations", + system_prompt="You are a mathematical computation specialist. Use the available tools to perform calculations.", + max_loops=1, + mcp_servers=[server_params], + streaming_on=True, + model_name="gpt-4o-mini" + ) + + # Start the MCP server mcp.run(transport="sse", host="0.0.0.0", port=8000)