Skip to content

✨ feat: Generic Tool-Calling A2A Agent#93

Merged
mrsabath merged 1 commit intokagenti:mainfrom
pzhao0:feat/generic_agent
Nov 20, 2025
Merged

✨ feat: Generic Tool-Calling A2A Agent#93
mrsabath merged 1 commit intokagenti:mainfrom
pzhao0:feat/generic_agent

Conversation

@pzhao0
Copy link
Copy Markdown
Contributor

@pzhao0 pzhao0 commented Nov 4, 2025

Summary

Created a new generic tool-calling LangGraph agent that can connect to multiple MCP servers and choose the proper tools to fulfill user requests. The agent is tool and LLM agnostic and works with any OpenAI-compatible API.

Features

  • Multi-MCP Support: Connect to multiple MCP servers simultaneously via comma-separated URLs
  • Dynamic Tool Discovery: Automatically loads and uses tools from all connected MCP servers
  • LLM Flexibility: Works with any OpenAI-compatible API, including Ollama and OpenAI
  • A2A Integration: Full support for A2A protocol as well as dynamic display of connected MCP servers in agent card

Configuration

The agent is configured via environment variables:

# Required
MCP_URLS="http://weather-tool:8000/mcp,http://movie-tool:8000/mcp" # Multiple MCP servers
MCP_URLS="http://weather-tool:8000/mcp" # Single MCP Server

# Optional (with defaults)
LLM_MODEL="llama3.2:3b-instruct-fp16"
LLM_API_BASE="http://localhost:11434/v1"
LLM_API_KEY="dummy"
MCP_TRANSPORT="streamable_http"

Usage Example

Once deployed, the agent can handle requests like:

"What's the weather in Boston?"
"What are the ratings for Moana?"
"Find me flights from SFO to TPE for November 22, 2025."

The agent automatically selects the appropriate tool from connected MCP servers and returns formatted results. It will also be compatible with the future MCP Gateway's single unified MCP endpoint.

Screenshots

Screenshot 2025-11-03 at 10 14 48 PM Screenshot 2025-11-03 at 10 24 51 PM

Related issue(s)

Works with MCP servers implemented in #90, #91

Fixes #86

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new Generic Agent implementation that integrates with the A2A (Agent-to-Agent) protocol, supporting multiple MCP (Model Context Protocol) servers for dynamic tool loading and LLM-based task orchestration.

  • Implements a flexible agent that connects to one or more MCP servers to provide various capabilities
  • Uses LangGraph for orchestration and supports streaming responses via the A2A protocol
  • Includes configuration management, tracing setup, and comprehensive error handling

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
graph.py Implements LangGraph workflow with MCP client integration and tool binding
config.py Defines Pydantic configuration settings for LLM, MCP, and agent parameters
agent.py Implements A2A agent executor with event handling and graph execution logic
__init__.py Sets up OpenTelemetry tracing for observability
pyproject.toml Specifies project dependencies and build configuration
README.md Provides documentation for features, configuration, and usage
Dockerfile Defines container image for deployment
.dockerignore Excludes virtual environment from Docker context

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kellyaa
Copy link
Copy Markdown
Contributor

kellyaa commented Nov 5, 2025

Looks great. Can you include the instructions to run in that are in the PR into the agent's README?

@pzhao0
Copy link
Copy Markdown
Contributor Author

pzhao0 commented Nov 5, 2025

Thank you, the environmental variables needed and Kagenti deployment instructions are in the README!

I'm still working through some of the feedback, should be ready by EOD tomorrow.

@kellyaa
Copy link
Copy Markdown
Contributor

kellyaa commented Nov 6, 2025

Perfect. I was able to connect this to both the Flight MCP tool and the weather tool at the same time and it worked interchangeably. This will be super useful for testing and demonstration, including testing the MCP gateway. Thank you! I'll check back when you are completed with the updates!

@kellyaa kellyaa self-assigned this Nov 6, 2025
@pzhao0 pzhao0 force-pushed the feat/generic_agent branch from 132b950 to 429228b Compare November 7, 2025 06:40
Signed-off-by: Peter Zhao <peterzhao080@gmail.com>
@pzhao0 pzhao0 force-pushed the feat/generic_agent branch from 429228b to 5a81565 Compare November 7, 2025 06:42
@pzhao0
Copy link
Copy Markdown
Contributor Author

pzhao0 commented Nov 7, 2025

Thank you, glad to hear that you were able to run it successfully! I made some updates, should be all set and let me know of any feedback you have.

Copy link
Copy Markdown
Contributor

@mrsabath mrsabath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very useful addition. Thank you @pzhao0 !
LGTM

@mrsabath mrsabath merged commit 9aaf4b8 into kagenti:main Nov 20, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Generic tool calling agent

4 participants