Setting up A2A for seamless AI agent integration

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1All 1564 services
Setting up A2A for seamless AI agent integration
Medium
from 1 day to 3 days
Frequently Asked Questions

AI Development Areas

AI Solution Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1357
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1250
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    955
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_logo-advance_0.webp
    B2B Advance company logo design
    646
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    926

A corporation with five divisions, each using its own AI agent on different frameworks. The financial agent on Python/LlamaIndex, legal on Node.js/LangChain, logistics on Java/Semantic Kernel. Launching a single portal for delegating tasks between them — without A2A this becomes supporting N*M integrations. We faced this challenge on one of our projects and chose Google's new A2A protocol. In this article, we'll walk through how we set up the A2A server and client, and why this solution worked.

The main advantage of A2A is the standard Agent Card, which describes the agent's capabilities in JSON. It's like OpenAPI but for agents. This makes discovery and AI agent task delegation trivial. We configured A2A end-to-end in two days, and we're ready to share our experience. If you have a similar task — contact us, we'll assess your project for free.

What problems does A2A solve?

The main pain point is agent heterogeneity. Each team chooses their own stack, and integration via custom APIs requires synchronizing contracts, documentation, and error handling. A2A standardizes this process:

  • Agent Card — a unified description of capabilities (like OpenAPI).
  • A unified transport — JSON-RPC 2.0, language-agnostic.
  • Streaming and push notifications — for long-running tasks.

Without A2A, integrating a new agent into the ecosystem takes weeks; with A2A, it takes one day. In our practice, A2A is 3x better than custom REST APIs for integration speed. On our projects, development costs dropped by 60–70%, saving up to $100,000 annually for a multi-division company, and investments pay back within 2–3 months.

How does A2A differ from MCP?

MCP (Model Context Protocol) is a protocol for accessing tools, while A2A is a protocol for inter-agent communication. They complement each other: MCP provides context, A2A provides coordination. You can use both in one project.

Parameter A2A MCP
Purpose Inter-agent communication Agent-tool access
Level Inter-agent Agent-tool
Transport A2A JSON-RPC 2.0 JSON-RPC 2.0 / Streamable HTTP
Discovery Agent Card (/.well-known/) Not built-in

What key A2A concepts should you know?

Agent Card — a JSON document describing the agent's capabilities, published at /.well-known/agent.json. Task — a unit of work with statuses (submitted, working, completed, failed). Artifact — the result of a task (text, file, JSON). Push Notifications — status change notifications via webhook.

How to set up an A2A server?

  1. Describe the Agent Card — JSON with name, description, version, skills.
  2. Implement task handlers — for each skill, write a function that accepts a Task and returns a Task with artifacts.
  3. Enable streaming — if the agent supports partial results.
  4. Start the server — use FastAPI with A2ARouter.

Agent Card example

// GET /.well-known/agent.json
{
  "name": "Financial Analysis Agent",
  "description": "Corporate financial data analysis agent",
  "url": "https://fin-agent.company.com",
  "version": "1.0.0",
  "capabilities": {
    "streaming": true,
    "pushNotifications": true,
    "stateTransitionHistory": true
  },
  "authentication": {
    "schemes": ["Bearer"]
  },
  "skills": [
    {
      "id": "financial_analysis",
      "name": "Financial Analysis",
      "description": "Financial data analysis, P&L, KPI calculation",
      "inputModes": ["text"],
      "outputModes": ["text", "application/json"],
      "examples": [
        "Analyze revenue for Q1 current vs Q1 previous",
        "Calculate EBITDA by divisions"
      ]
    },
    {
      "id": "forecast",
      "name": "Revenue Forecast",
      "description": "Revenue forecasting based on historical data",
      "inputModes": ["text", "application/json"],
      "outputModes": ["text", "application/json"]
    }
  ]
}

A2A server in Python

# pip install a2a-sdk
from a2a.server.fastapi import A2AServer, A2ARouter
from a2a.types import AgentCard, AgentSkill, Task, TaskStatus, Artifact, TextArtifact
from fastapi import FastAPI
import uuid

# Agent Card
agent_card = AgentCard(
    name="Financial Analysis Agent",
    description="Financial analysis agent",
    url="https://fin-agent.company.com",
    version="1.0.0",
    skills=[
        AgentSkill(
            id="financial_analysis",
            name="Financial Analysis",
            description="P&L analysis, KPI calculation, anomaly detection",
        )
    ],
)

app = FastAPI()
a2a_router = A2ARouter(agent_card=agent_card)

@a2a_router.on_task("financial_analysis")
async def handle_financial_task(task: Task) -> Task:
    """Financial analysis task handler"""
    user_input = task.input.message.parts[0].text
    result = await financial_agent.analyze(user_input)
    task.artifacts = [
        TextArtifact(
            name="analysis_result",
            parts=[{"type": "text", "text": result}],
        )
    ]
    task.status = TaskStatus(state="completed")
    return task

@a2a_router.on_task("financial_analysis", streaming=True)
async def handle_streaming_task(task: Task):
    """Streaming handler"""
    user_input = task.input.message.parts[0].text
    async for chunk in financial_agent.stream_analyze(user_input):
        yield TaskStatus(state="working"), TextArtifact(
            name="partial_result",
            parts=[{"type": "text", "text": chunk}],
        )

app.include_router(a2a_router)

A2A client: AI agent task delegation

from a2a.client import A2AClient

# Agent discovery
client = await A2AClient.from_url("https://fin-agent.company.com")
agent_card = client.agent_card

print(f"Agent: {agent_card.name}")
print(f"Skills: {[s.name for s in agent_card.skills]}")

# Send task
task = await client.send_task(
    skill_id="financial_analysis",
    message="Analyze revenue deviation from plan for March current year",
)

# Wait for result
completed_task = await client.wait_for_completion(task.id)
print(completed_task.artifacts[0].parts[0]["text"])

# Streaming
async for status, artifact in client.stream_task(
    skill_id="financial_analysis",
    message="Create revenue forecast for Q2 current year",
):
    if artifact:
        print(artifact.parts[0]["text"], end="", flush=True)

Integrating A2A with LangGraph

from langgraph.graph import StateGraph, END
from a2a.client import A2AClient
from typing import Optional, TypedDict

class OrchestratorState(TypedDict):
    task: str
    financial_result: Optional[str]
    legal_result: Optional[str]
    final_report: Optional[str]

# Node that delegates task to an external A2A agent
async def delegate_to_financial_agent(state: OrchestratorState):
    client = await A2AClient.from_url("https://fin-agent.company.com")
    task_ = await client.send_task(
        skill_id="financial_analysis",
        message=state["task"],
    )
    completed = await client.wait_for_completion(task_.id, timeout=120)
    return {"financial_result": completed.artifacts[0].parts[0]["text"]}

async def delegate_to_legal_agent(state: OrchestratorState):
    client = await A2AClient.from_url("https://legal-agent.legalteam.com")
    task_ = await client.send_task(
        skill_id="contract_review",
        message=state["task"],
    )
    completed = await client.wait_for_completion(task_.id, timeout=180)
    return {"legal_result": completed.artifacts[0].parts[0]["text"]}

# Orchestrator combines results from two external agents
graph = StateGraph(OrchestratorState)
graph.add_node("financial", delegate_to_financial_agent)
graph.add_node("legal", delegate_to_legal_agent)
graph.add_node("synthesize", synthesize_results)
# ...

Practical case: enterprise agent marketplace

From our practice: a holding company with several divisions, each had developed specialized agents (finance, legal, HR, logistics) on different frameworks. A2A became the integration layer: the corporate portal orchestrator delegates tasks to agents via a standard protocol, without knowing about internal implementations. The scheme:

  • Portal Agent (LangGraph) → Financial Agent (Python/LlamaIndex) via A2A
  • Portal Agent → Legal Agent (Node.js/LangChain) via A2A
  • Portal Agent → HR Agent (Java/Semantic Kernel) via A2A

Results:

  • Integrating a new agent into the ecosystem: 1 day (publishing Agent Card + implementing A2A endpoint)
  • Changing an agent's internal implementation is transparent to the orchestrator
  • Each team owns their agent, cross-team collaboration simplified
  • Time savings when integrating a new agent is up to 70% compared to custom API

The A2A specification describes these principles. Our experience — 50+ AI projects, 5 years on the market, and over 200 client implementations. We guarantee the integration will go smoothly. To discuss your project, contact us — we will conduct a free audit of your agents and propose the optimal solution.

What's included in A2A setup?

  1. Audit of current agents and Agent Card description
  2. Development of A2A server with FastAPI
  3. Configuring A2A client in the orchestrator
  4. Testing delegation scenarios
  5. Documentation and team training
  6. Post-deployment support

Timelines

  • Setting up A2A server with an agent: 2–3 days
  • A2A client in orchestrator: 1–2 days
  • Full marketplace with multiple agents: 2–3 weeks

Contact us for a consultation — we'll help you choose the optimal protocol and configure inter-agent interaction for your stack. Order A2A setup: write to us and we'll prepare a proposal for your project.

LLM Development: Fine-Tuning, RAG, Agents, and Production Deployment

Using GPT‑4 or Claude 3.5 Sonnet through a public API is not a solution — it's just a tool. When the requirement is to "make it like ChatGPT, but on our data," there is a real engineering challenge behind it: from prompt engineering to training a 70B model on your own infrastructure. End-to-end LLM solution development is a complex stack, and we have been doing it for over 5 years. During this time, we have completed over 20 projects in generative AI: from RAG systems for legal departments to custom support agents. Where exactly your task falls depends on data, latency requirements, budget, and how critical confidentiality is.

A typical situation: the client has already tried ChatGPT, but results are unstable — sometimes accurate, sometimes hallucinating. Or they need integration into a corporate portal while complying with security policies. Let's break down each layer of the stack in detail — from RAG to production deployment.

Why Do RAG Systems Break and How to Fix It?

RAG (Retrieval-Augmented Generation) looks simple: find relevant documents, put them in context, get an answer. In practice, it fails in several places.

Chunking without overlap. Classic mistake: chunk_size=512, overlap=0. If the answer lies across two chunks, retrieval won't find either with sufficient confidence. Solution: overlap 15–25% of chunk_size, or better yet, sentence-aware splitting with spaCy or NLTK instead of naive character splitting.

Poor embedder. text-embedding-ada-002 is good for general use, but on legal or medical texts, specialized models like E5-large-v2, BGE-M3, or fine-tuned sentence-transformers on domain data outperform it. Recall@5 differences can be 15–25%.

No re-ranking. Vector search optimizes for speed, not relevance. A cross-encoder re-ranker (ms-marco-MiniLM-L-6-v2, bge-reranker-large) after initial retrieval improves top-3 accuracy with acceptable latency (+50–150ms). This is often more impactful than improving the embedding model.

Hybrid search. Dense vectors alone work poorly on exact queries: names, SKUs, codes. BM25 (sparse) finds exact matches but misses semantics. Hybrid via RRF (Reciprocal Rank Fusion) is the optimal compromise. Qdrant, Weaviate, and pgvector 0.7+ support hybrid search natively.

Typical production architecture for a corporate knowledge base
  1. Documents → preprocessing (PyMuPDF, Unstructured)
  2. Chunking → embedding (BGE-M3)
  3. Qdrant (hybrid dense+sparse)
  4. Cross-encoder re-ranking
  5. Context → LLM (vLLM or OpenAI API)
  6. Answer with sources (RAGAS for quality evaluation)

When to Fine-Tune Instead of Prompt Engineering?

Prompt engineering solves ~70% of LLM adaptation tasks for a domain. The remaining 30% require fine-tuning. Three indicators: the model ignores a specific output format even with detailed prompting; the task requires deep knowledge of specialized vocabulary (medicine, law); you need to significantly reduce token costs by replacing a large model with a smaller specialized one.

LoRA and QLoRA are the standard for SFT. LoRA adds trainable low-rank matrices to attention layers. A typical configuration for Llama-3 8B: r=64, lora_alpha=128, target_modules=["q_proj","v_proj","k_proj","o_proj"] yields ~0.8% trainable parameters, training on one A100 40GB. QLoRA adds 4-bit quantization (NF4) and allows fine-tuning 70B models on two A100 40GB, though speed drops by half compared to bf16.

DPO instead of RLHF. Direct Preference Optimization requires only (chosen, rejected) pairs, not scalar reward signals. DPOTrainer from the trl library (Hugging Face) implements it in a few dozen lines.

Common mistake. A dataset of 500 examples, 5 epochs, validation loss 0.8 — seems fine. But on test, the model degrades on general instructions. Cause: catastrophic forgetting. Solution: add 10–20% general instruction-following examples (Alpaca, FLAN) to the training set to preserve original capabilities.

How to Choose a Base Model: 8B or 70B?

Model Parameters Strengths Context
Llama-3.1 8B 8B Quality/speed balance 128k
Llama-3.1 70B 70B Complex reasoning 128k
Mistral 7B / Mixtral 8x7B 7B / 47B Efficiency for size 32k
Qwen2.5 72B 72B Code, multilingual 128k
Gemma 2 27B 27B Open license 8k

For most tasks, fine-tuning an 8B model is sufficient. 70B is needed when deep reasoning is required or the 8B baseline does not reach the required quality even after fine-tuning. Inference cost for Llama-3 8B via vLLM on A100 is efficient; the exact cost depends on volume.

What Does PagedAttention Bring to Production?

vLLM is the first choice for serving open-source models. PagedAttention is the key technical innovation: KV-cache is managed like virtual memory in an OS, without fragmentation. This yields 2–4x higher throughput compared to naive HuggingFace Transformers inference. The vLLM documentation confirms that continuous batching and PagedAttention are the standard for high-load LLM services.

Typical numbers on A100 80GB for Llama-3 8B (bf16): 400–600 req/s, P50 latency 200–400ms, P99 latency 600–900ms at concurrency 64. For 70B on two A100 with tensor parallelism: 80–120 req/s, P99 latency 1.5–2.5s. AWQ or GPTQ quantization reduces memory consumption by 2x with quality loss within 1–3%.

Multi-Agent Systems

Agents are LLMs with access to tools: search, code execution, API calls, database interaction. Common patterns:

  • ReAct (Reason + Act): the model reasons → chooses a tool → observes the result → reasons again. LangChain and LlamaIndex implement it out of the box.
  • Multi-agent orchestration: multiple specialized agents with a coordinator on top. Example: coordinator → researcher (search + summarization) → coder (code generation and execution) → critic (verification). Tools: AutoGen (Microsoft), CrewAI, custom implementation on LangGraph.

In production, agent systems are non-deterministic. Essential: guardrails, step limits, logging of each step, human-in-the-loop for critical actions.

How We Work: Stages, Timeline, Deliverables

Stage Duration What You Get
Audit and data collection 1–2 weeks Eval dataset of 100+ examples, task formalization
Baseline (prompt + RAG) 1–2 weeks Working prototype, quality metrics
Fine-tuning (if needed) 2–4 weeks Trained model, LoRA weights, model card
Deployment and monitoring 1–2 weeks vLLM server, Grafana + Prometheus
Documentation and training 1 week API documentation, team training

What Is Included

We deliver:

  • Technical documentation (model card, configs, deployment instructions)
  • Access to infrastructure (code repository, trained weights)
  • 1 month of post-deployment support (consultations, bug fixes)
  • Customer team training (2–3 sessions on system operation)

Timeline: basic RAG prototype — 1–2 weeks. Fine-tuning with customer data — 3–6 weeks (including data preparation). Production system with monitoring and retraining — 2–4 months. Cost is calculated individually based on data volume, model complexity, and infrastructure requirements.

We guarantee the quality of the final model with performance benchmarks and ongoing monitoring. Our engineers have hands‑on experience with dozens of production LLM systems.

Want to evaluate your project? Leave a request — we will prepare a preliminary summary within 1–2 business days. Or get a consultation on choosing the approach: RAG, fine-tuning, or hybrid — we will tell you what works best for you. Contact us to discuss your LLM development needs. Schedule a free consultation today.