Skip to content

feat(python/langgraph): upgrade langgraph agent to a2a-sdk 1.1+ (protocol v1.0) - #705

Open
1Wizzy wants to merge 1 commit into
a2aproject:mainfrom
1Wizzy:feat/upgrade-langgraph-agent-v1.0
Open

1Wizzy wants to merge 1 commit into
a2aproject:mainfrom
1Wizzy:feat/upgrade-langgraph-agent-v1.0

Conversation

@1Wizzy

@1Wizzy 1Wizzy commented Sep 10, 2026 •

Copy link
Copy Markdown

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

Fixes # 🦕


Summary of Changes

This PR upgrades the LangGraph Currency Agent sample (samples/python/agents/langgraph) from legacy a2a-sdk 0.3.x to the official stable a2a-sdk >= 1.1.0 (A2A Protocol v1.0 specification) and langgraph >= 1.0.0.

1. A2A Protocol v1.0 & LangGraph 1.0 Upgrade

  • Dependencies (pyproject.toml, uv.lock):
    • Upgraded to a2a-sdk>=1.1.0 and langgraph>=1.0.0.
  • Server Architecture (app/__main__.py):
    • Replaced deprecated A2AStarletteApplication with modular route factories: create_agent_card_routes and create_jsonrpc_routes on Starlette.
    • Declared AgentCard with v1.0 AgentInterface (protocol_binding='JSONRPC', url='http://{host}:{port}/', protocol_version='1.0').
    • Passed agent_card into DefaultRequestHandler.
  • Execution & Lifecycle (app/agent_executor.py):
    • Migrated from legacy a2a.utils to a2a.helpers (new_task_from_user_message, new_text_message, new_text_part).
    • Implemented event and status management using a2a.server.tasks.TaskUpdater (start_work(), requires_input(), complete(), add_artifact()).
    • Standardized error handling using InvalidParamsError, InternalError, and UnsupportedOperationError.
  • Client & Verification (app/test_client.py):
    • Migrated to await create_client(agent=..., client_config=...).
    • Upgraded messaging requests to SendMessageRequest using protobuf enums (Role.ROLE_USER).
  • Documentation (README.md):
    • Modernized CLI run instructions (uv run python -m app).
    • Updated JSON-RPC payload examples to protocol v1.0 standards (SendMessage, SendStreamingMessage, A2A-Version: 1.0, protobuf JSON structures).
    • Updated Mermaid sequence diagram with TASK_STATE_INPUT_REQUIRED.
    • Wrapped disclaimer text to comply with Markdownlint (MD013).

2. Robustness Improvements

  • Frankfurter API 301 Redirect: Added follow_redirects=True to httpx.get in app/agent.py to handle upstream 301 redirect to api.frankfurter.dev.
  • OpenAI-Compatible LLMs: Added _CompatibleChatOpenAI defaulting with_structured_output to function_calling instead of strict json_schema, ensuring compatibility with non-OpenAI gateways (Ollama, DeepSeek, vLLM).
  • Client Timeout: Provided custom httpx.AsyncClient with a 60s timeout to ClientConfig in test_client.py to avoid premature client timeouts during multi-step tool calls.

Verification & Testing

  • Linting & Formatting:
    • uv run ruff check --config .ruff.toml samples/python/agents/langgraph (Passed, 0 errors).
    • uv run ruff format --check --config .ruff.toml samples/python/agents/langgraph (Passed, clean).
  • Type Checking:
    • uv run pyright samples/python/agents/langgraph (Passed, 0 errors, 0 warnings).
  • End-to-End Runtime Test:
    • Single-turn execution with artifact generation (conversion_result).
    • Multi-turn interaction with TASK_STATE_INPUT_REQUIRED.
    • Real-time streaming updates (SendStreamingMessage via SSE).

Note on CI Checks: Lint Code Base (super-linter, ruff, markdownlint) is passing. The failing Lint Go check is an upstream issue in samples/go/agents/deepresearch (being resolved in #704) and is unrelated to this Python PR.

@1Wizzy
1Wizzy force-pushed the feat/upgrade-langgraph-agent-v1.0 branch from 23d0bd0 to ada958c Compare September 10, 2026 09:01
@samirbajaj

Copy link
Copy Markdown

@1Wizzy - are we just waiting for the upstream fix in #704 ?
I'd love to see this merged.

This branch has not been deployed

No deployments
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.

2 participants