{"_id":"@ag-ui/adk","_rev":"2-949cb44c641ed30354525e830a9eeed2","name":"@ag-ui/adk","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@ag-ui/adk","version":"0.0.1","keywords":["ag-ui","adk","google","agent-development-kit","agents","ai"],"author":{"name":"Mark Fogle","email":"mark@contextable.com"},"license":"MIT","_id":"@ag-ui/adk@0.0.1","maintainers":[{"name":"_mme","email":"markus.ecker@gmail.com"},{"name":"copilotkit","email":"devops@copilotkit.ai"}],"homepage":"https://github.com/ag-ui-protocol/ag-ui#readme","bugs":{"url":"https://github.com/ag-ui-protocol/ag-ui/issues"},"dist":{"shasum":"a8d12bed8716b3315e6948ccf22f6580712623d6","tarball":"https://registry.npmjs.org/@ag-ui/adk/-/adk-0.0.1.tgz","fileCount":11,"integrity":"sha512-kdBDoD9gRPuim0yne61Yr1+bRf14cUnH7SMpj5IGknyTO+scY8jGe8bcUuD0sUrFs5TNjurzxbDUytFq+6oBMw==","signatures":[{"sig":"MEQCIAXguk/QP1o71uw0gXoBD+R8sG/j7K60HXtqtDc5OvCsAiArmeg+DMH1N4cF6nfeUlKc2HQadH4OSo8c50Emc/xSiQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20604},"main":"./dist/index.js","_from":"file:/Users/jpr5/proj/cpk/ag-ui-enroll-cf/integrations/adk-middleware/typescript/ag-ui-adk-0.0.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"d049e55a53af652059e031429f57ba72762503fe","private":false,"scripts":{"dev":"tsdown --watch","test":"vitest run","build":"tsdown","clean":"git clean -fdX --exclude=\"!.env\"","typecheck":"tsc --noEmit","test:watch":"vitest","link:global":"pnpm link --global","test:exports":"publint --strict && attw --pack","test:coverage":"vitest run --coverage","unlink:global":"pnpm unlink --global"},"_npmUser":{"name":"copilotkit","email":"devops@copilotkit.ai"},"_resolved":"/Users/jpr5/proj/cpk/ag-ui-enroll-cf/integrations/adk-middleware/typescript/ag-ui-adk-0.0.1.tgz","_integrity":"sha512-kdBDoD9gRPuim0yne61Yr1+bRf14cUnH7SMpj5IGknyTO+scY8jGe8bcUuD0sUrFs5TNjurzxbDUytFq+6oBMw==","repository":{"url":"git+https://github.com/ag-ui-protocol/ag-ui.git","type":"git","directory":"integrations/adk-middleware/typescript"},"_npmVersion":"11.15.0","description":"AG-UI integration for Google ADK (Agent Development Kit) - thin TypeScript client for ADK-backed AG-UI agents","directories":{},"sideEffects":false,"_nodeVersion":"25.8.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.20.1","vitest":"^4.0.18","publint":"^0.3.12","typescript":"^5.3.3","@ag-ui/core":"0.0.55","@types/node":"^20.11.19","@ag-ui/client":"0.0.55","@arethetypeswrong/cli":"^0.17.4"},"peerDependencies":{"rxjs":"7.8.1","@ag-ui/core":">=0.0.37","@ag-ui/client":">=0.0.37"},"_npmOperationalInternal":{"tmp":"tmp/adk_0.0.1_1780637762383_0.9121285330475961","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@ag-ui/adk","version":"0.0.2","description":"AG-UI integration for Google ADK (Agent Development Kit) - thin TypeScript client for ADK-backed AG-UI agents","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","sideEffects":false,"keywords":["ag-ui","adk","google","agent-development-kit","agents","ai"],"peerDependencies":{"@ag-ui/core":">=0.0.55","@ag-ui/client":">=0.0.55","rxjs":"7.8.1"},"devDependencies":{"@types/node":"^20.11.19","publint":"^0.3.12","@arethetypeswrong/cli":"^0.17.4","tsdown":"^0.20.1","typescript":"^5.3.3","vitest":"^4.0.18","@ag-ui/core":"0.0.55","@ag-ui/client":"0.0.55"},"repository":{"type":"git","url":"git+https://github.com/ag-ui-protocol/ag-ui.git","directory":"integrations/adk-middleware/typescript"},"author":{"name":"Mark Fogle","email":"mark@contextable.com"},"license":"MIT","private":false,"publishConfig":{"access":"public"},"exports":{".":{"require":"./dist/index.js","import":"./dist/index.mjs"},"./package.json":"./package.json"},"scripts":{"build":"tsdown","dev":"tsdown --watch","clean":"git clean -fdX --exclude=\"!.env\"","typecheck":"tsc --noEmit","test":"vitest run","test:coverage":"vitest run --coverage","test:watch":"vitest","test:exports":"publint --strict && attw --pack","link:global":"pnpm link --global","unlink:global":"pnpm unlink --global"},"_id":"@ag-ui/adk@0.0.2","bugs":{"url":"https://github.com/ag-ui-protocol/ag-ui/issues"},"homepage":"https://github.com/ag-ui-protocol/ag-ui#readme","_integrity":"sha512-SWW//eHWNE06xBgkjO332V3faSeO56DNFM6LCS0qr+xEJAHn6qcjiPmrBoFBz94ghsYmLMSplDzHyy77JrUKng==","_resolved":"/home/runner/work/ag-ui/ag-ui/integrations/adk-middleware/typescript/ag-ui-adk-0.0.2.tgz","_from":"file:ag-ui-adk-0.0.2.tgz","_nodeVersion":"22.22.3","_npmVersion":"11.15.0","dist":{"integrity":"sha512-SWW//eHWNE06xBgkjO332V3faSeO56DNFM6LCS0qr+xEJAHn6qcjiPmrBoFBz94ghsYmLMSplDzHyy77JrUKng==","shasum":"db80843c48919c9f1610696a76fcfbc70342c9b2","tarball":"https://registry.npmjs.org/@ag-ui/adk/-/adk-0.0.2.tgz","fileCount":11,"unpackedSize":21770,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ag-ui%2fadk@0.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDIaCgy8dI/jlhlCLqE9A0NRUyZfMGS6zN09TLNYHZHdAIhAMUzodx7DLCY5TBbRD75ovDkj1pTF6IAB3PcyGQsCF3h"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8be20871-948a-468e-91e7-e5e60bc38b97"}},"directories":{},"maintainers":[{"name":"_mme","email":"markus.ecker@gmail.com"},{"name":"copilotkit","email":"devops@copilotkit.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adk_0.0.2_1780640099125_0.8227829836962077"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-05T05:36:02.199Z","modified":"2026-06-05T06:14:59.616Z","0.0.1":"2026-06-05T05:36:02.547Z","0.0.2":"2026-06-05T06:14:59.274Z"},"bugs":{"url":"https://github.com/ag-ui-protocol/ag-ui/issues"},"author":{"name":"Mark Fogle","email":"mark@contextable.com"},"license":"MIT","homepage":"https://github.com/ag-ui-protocol/ag-ui#readme","keywords":["ag-ui","adk","google","agent-development-kit","agents","ai"],"repository":{"type":"git","url":"git+https://github.com/ag-ui-protocol/ag-ui.git","directory":"integrations/adk-middleware/typescript"},"description":"AG-UI integration for Google ADK (Agent Development Kit) - thin TypeScript client for ADK-backed AG-UI agents","maintainers":[{"name":"_mme","email":"markus.ecker@gmail.com"},{"name":"copilotkit","email":"devops@copilotkit.ai"}],"readme":"# @ag-ui/adk\n\nAG-UI integration for [Google ADK](https://google.github.io/adk-docs/) (Agent Development Kit). This package ships a thin TypeScript client, `ADKAgent`, that connects an AG-UI front end to an ADK-backed agent endpoint served by the companion Python middleware (`ag_ui_adk`).\n\n`ADKAgent` extends `HttpAgent` from `@ag-ui/client`, so it speaks the full AG-UI protocol over HTTP/SSE out of the box. On top of that it adds a `getCapabilities()` method that fetches and validates the agent's advertised capabilities.\n\n## Installation\n\n```bash\nnpm install @ag-ui/adk\n# or\npnpm add @ag-ui/adk\n```\n\n### Peer Dependencies\n\n- `@ag-ui/client` (>=0.0.55)\n- `@ag-ui/core` (>=0.0.55)\n- `rxjs` (7.8.1)\n\n## TypeScript Client Usage\n\n### Connect to an ADK-backed agent\n\n```typescript\nimport { ADKAgent } from \"@ag-ui/adk\";\n\n// `threadId` and `initialMessages` are constructor options (AgentConfig),\n// not run-time parameters.\nconst agent = new ADKAgent({\n  url: \"http://localhost:8000/chat\",\n  threadId: \"thread-123\",\n  initialMessages: [{ id: \"1\", role: \"user\", content: \"Hello!\" }],\n});\n\n// `run(input)` returns an RxJS Observable of AG-UI events. It takes a full\n// `RunAgentInput`, so reuse the agent's `threadId`/`messages`/`state` and\n// supply the remaining required fields.\nagent\n  .run({\n    threadId: agent.threadId,\n    runId: \"run-456\",\n    messages: agent.messages,\n    state: agent.state,\n    tools: [],\n    context: [],\n    forwardedProps: {},\n  })\n  .subscribe({\n    next: (event) => {\n      switch (event.type) {\n        case \"TEXT_MESSAGE_CONTENT\":\n          process.stdout.write(event.delta);\n          break;\n        case \"TOOL_CALL_START\":\n          console.log(\"Calling tool:\", event.toolCallName);\n          break;\n      }\n    },\n    error: (err) => console.error(\"Run failed:\", err),\n    complete: () => console.log(\"Done\"),\n  });\n```\n\n`ADKAgent` accepts the same configuration as `HttpAgent` (`url`, `headers`, `agentId`, `threadId`, `initialMessages`, etc.). Only `run(input)` is the Observable API — it takes a full `RunAgentInput` and returns an `Observable<BaseEvent>`. The Promise-based `runAgent(parameters?, subscriber?)` is the alternative: it manages `threadId`/`messages`/`state` for you, accepts only `runId`/`tools`/`context`/`forwardedProps`/`resume`, and resolves to a `RunAgentResult` (it is not subscribable).\n\n### Discover agent capabilities\n\n`getCapabilities()` issues a `GET` against the agent's `/capabilities` endpoint (derived from the configured `url`), parses the JSON response, and validates it against the AG-UI `AgentCapabilitiesSchema`. It rejects on HTTP errors, unparseable bodies, or schema-invalid responses.\n\n```typescript\nimport { ADKAgent } from \"@ag-ui/adk\";\n\nconst agent = new ADKAgent({ url: \"http://localhost:8000/chat\" });\n\nconst capabilities = await agent.getCapabilities();\nconsole.log(capabilities);\n```\n\nTo customize how capabilities are fetched (auth, headers, credentials, or the URL itself), subclass `ADKAgent` and override the protected `capabilitiesUrl()` and/or `capabilitiesRequestInit()` methods.\n\n---\n\nThe remainder of this document covers the companion **Python middleware** (`ag_ui_adk`) that serves the ADK agent endpoint the TypeScript client above connects to.\n\n## Python Middleware\n\nThis Python middleware enables [Google ADK](https://google.github.io/adk-docs/) agents to be used with the AG-UI Protocol, providing a bridge between the two frameworks.\n\n## Prerequisites\n\nThe examples use ADK Agents using various Gemini models along with the AG-UI Dojo.\n\n- A [Gemini API Key](https://makersuite.google.com/app/apikey). The examples assume that this is exported via the GOOGLE_API_KEY environment variable.\n\n## Quick Start\n\nTo use this integration you need to:\n\n1. Clone the [AG-UI repository](https://github.com/ag-ui-protocol/ag-ui).\n\n    ```bash\n    git clone https://github.com/ag-ui-protocol/ag-ui.git\n    ```\n\n2. Change to the `integrations/adk-middleware/python` directory.\n\n    ```bash\n    cd integrations/adk-middleware/python\n    ```\n\n3. Install the `ag_ui_adk` package from the local directory.  For example,\n\n    ```bash\n    pip install .\n    ```\n\n    or\n\n    ```bash\n    uv pip install .\n    ```\n\n    This installs the package from the current directory which contains:\n    - `src/ag_ui_adk/` - The middleware source code\n    - `examples/` - Example servers and agents\n    - `tests/` - Test suite\n\n4. Run the example FastAPI server. The example project pulls in its own\n   dependencies (including the local middleware) via `uv sync`.\n\n    ```bash\n    export GOOGLE_API_KEY=<My API Key>\n    cd examples\n    uv sync\n    uv run dev\n    ```\n\n5. Open another terminal in the root directory of the ag-ui repository clone.\n\n6. Start the integration ag-ui dojo:\n\n    ```bash\n    pnpm install && pnpm run dev\n    ```\n\n7. Visit [http://localhost:3000/adk-middleware](http://localhost:3000/adk-middleware).\n\n8. Select View `ADK Middleware` from the sidebar.\n\n### Development Setup\n\nIf you want to contribute to ADK Middleware development, install the package in\neditable mode with its dev dependencies:\n\n```bash\n# From the integrations/adk-middleware/python directory\n\n# Install this package in editable mode\npip install -e .\n\n# For development (includes testing and linting tools)\npip install -e \".[dev]\"\n```\n\nThis installs the ADK middleware in editable mode for development.\n\n## Testing\n\n```bash\n# Run the test suite\npytest\n\n# With coverage\npytest --cov=src/ag_ui_adk\n\n# Specific test file\npytest tests/test_adk_agent.py\n```\n## Usage options\n\n### Option 1: Direct Usage\n```python\nfrom ag_ui_adk import ADKAgent\nfrom google.adk.agents import Agent\n\n# 1. Create your ADK agent\nmy_agent = Agent(\n    name=\"assistant\",\n    instruction=\"You are a helpful assistant.\"\n)\n\n# 2. Create the middleware with direct agent embedding\nagent = ADKAgent(\n    adk_agent=my_agent,\n    app_name=\"my_app\",\n    user_id=\"user123\"\n)\n\n# 3. Use directly with AG-UI RunAgentInput\nasync for event in agent.run(input_data):\n    print(f\"Event: {event.type}\")\n```\n\n### Option 2: FastAPI Server\n\n```python\nfrom fastapi import FastAPI\nfrom ag_ui_adk import ADKAgent, add_adk_fastapi_endpoint\nfrom google.adk.agents import Agent\n\n# 1. Create your ADK agent\nmy_agent = Agent(\n    name=\"assistant\",\n    instruction=\"You are a helpful assistant.\"\n)\n\n# 2. Create the middleware with direct agent embedding\nagent = ADKAgent(\n    adk_agent=my_agent,\n    app_name=\"my_app\",\n    user_id=\"user123\"\n)\n\n# 3. Create FastAPI app\napp = FastAPI()\nadd_adk_fastapi_endpoint(app, agent, path=\"/chat\")\n\n# Run with: uvicorn your_module:app --host 0.0.0.0 --port 8000\n```\n\nFor detailed configuration options, see [CONFIGURATION.md](https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/CONFIGURATION.md).\n\n\n## Running the ADK Backend Server for Dojo App\n\nTo run the ADK backend server that works with the Dojo app, run the example\nserver from the `integrations/adk-middleware/python/examples` directory:\n\n```bash\ncd examples\nuv sync\nuv run dev\n```\n\nThis starts a FastAPI server (the `server:main` entrypoint) that connects your ADK middleware to the Dojo application.\n\n## Examples\n\n### Simple Conversation\n\n```python\nimport asyncio\nfrom ag_ui_adk import ADKAgent\nfrom google.adk.agents import Agent\nfrom ag_ui.core import RunAgentInput, UserMessage\n\nasync def main():\n    # Setup\n    my_agent = Agent(name=\"assistant\", instruction=\"You are a helpful assistant.\")\n\n    agent = ADKAgent(\n        adk_agent=my_agent,\n        app_name=\"demo_app\",\n        user_id=\"demo\"\n    )\n\n    # Create input\n    input = RunAgentInput(\n        thread_id=\"thread_001\",\n        run_id=\"run_001\",\n        messages=[\n            UserMessage(id=\"1\", role=\"user\", content=\"Hello!\")\n        ],\n        context=[],\n        state={},\n        tools=[],\n        forwarded_props={}\n    )\n\n    # Run and handle events\n    async for event in agent.run(input):\n        print(f\"Event: {event.type}\")\n        if hasattr(event, 'delta'):\n            print(f\"Content: {event.delta}\")\n\nasyncio.run(main())\n```\n\n### Multi-Agent Setup\n\n```python\n# Create multiple agent instances with different ADK agents\ngeneral_agent_wrapper = ADKAgent(\n    adk_agent=general_agent,\n    app_name=\"demo_app\",\n    user_id=\"demo\"\n)\n\ntechnical_agent_wrapper = ADKAgent(\n    adk_agent=technical_agent,\n    app_name=\"demo_app\",\n    user_id=\"demo\"\n)\n\ncreative_agent_wrapper = ADKAgent(\n    adk_agent=creative_agent,\n    app_name=\"demo_app\",\n    user_id=\"demo\"\n)\n\n# Use different endpoints for each agent\nfrom fastapi import FastAPI\nfrom ag_ui_adk import add_adk_fastapi_endpoint\n\napp = FastAPI()\nadd_adk_fastapi_endpoint(app, general_agent_wrapper, path=\"/agents/general\")\nadd_adk_fastapi_endpoint(app, technical_agent_wrapper, path=\"/agents/technical\")\nadd_adk_fastapi_endpoint(app, creative_agent_wrapper, path=\"/agents/creative\")\n```\n\n## Tool Support\n\nThe middleware provides complete bidirectional tool support, enabling AG-UI Protocol tools to execute within Google ADK agents. All tools supplied by the client are currently implemented as long-running tools that emit events to the client for execution and can be combined with backend tools provided by the agent to create a hybrid combined toolset.\n\nFor detailed information about tool support, see [TOOLS.md](https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/TOOLS.md).\n\n## Additional Documentation\n\nThese guides live in the companion Python middleware directory:\n\n- **[CONFIGURATION.md](https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/CONFIGURATION.md)** - Complete configuration guide\n- **[TOOLS.md](https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/TOOLS.md)** - Tool support documentation\n- **[USAGE.md](https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/USAGE.md)** - Usage examples and patterns\n- **[ARCHITECTURE.md](https://github.com/ag-ui-protocol/ag-ui/blob/main/integrations/adk-middleware/python/ARCHITECTURE.md)** - Technical architecture and design details\n","readmeFilename":"README.md"}