Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
.ruff_cache
uv.lock
.venv
**/node_modules
**/node_modules
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,37 @@ Universal Commerce Protocol (UCP).

A reference implementation of a UCP Merchant Server using Python and FastAPI.

* **Server**: [Documentation](rest/python/server/README.md)

* Located in `rest/python/server/`.
* Demonstrates capability discovery, checkout session management, payment
processing, and order lifecycle.
* Includes simulation endpoints for testing.

* **Client**:
[Happy Path Script](rest/python/client/flower_shop/simple_happy_path_client.py)

* Located in `rest/python/client/`.
* A script demonstrating a full "happy path" user journey (discovery ->
checkout -> payment).
- **Server**: [Documentation](rest/python/server/README.md)
- Located in `rest/python/server/`.
- Demonstrates capability discovery, checkout session management, payment
processing, and order lifecycle.
- Includes simulation endpoints for testing.

- **Client**:
[Happy Path Script](rest/python/client/flower_shop/simple_happy_path_client.py)
- Located in `rest/python/client/`.
- A script demonstrating a full "happy path" user journey (discovery ->
checkout -> payment).

### Node.js

A reference implementation of a UCP Merchant Server using Node.js, Hono, and
Zod.

* **Server**: [Documentation](rest/nodejs/README.md)
* Located in `rest/nodejs/`.
* Demonstrates implementation of UCP specifications for shopping,
checkout, and order management using a Node.js stack.
- **Server**: [Documentation](rest/nodejs/README.md)
- Located in `rest/nodejs/`.
- Demonstrates implementation of UCP specifications for shopping,
checkout, and order management using a Node.js stack.

### A2A (Agent-to-Agent)

An AI-powered retail agent implementing UCP via the A2A protocol.

* **Cymbal Retail Agent**: [Documentation](a2a/README.md)
* Located in `a2a/business_agent/`.
* Demonstrates A2A protocol integration with UCP Extension.
* Includes AI-powered shopping assistant with Google ADK and Gemini.
* React-based chat client for user interaction.
- **Cymbal Retail Agent**: [Documentation](a2a/README.md)
- Located in `a2a/business_agent/`.
- Demonstrates A2A protocol integration with UCP Extension.
- Includes AI-powered shopping assistant with Google ADK and Gemini.
- React-based chat client for user interaction.

## Getting Started

Expand Down
73 changes: 37 additions & 36 deletions a2a/DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This guide is for developers who want to understand how the sample works interna
**Prerequisites:** Complete the [Quick Start in README.md](README.md#quick-start) first.

**What you'll learn:**

- System architecture and component responsibilities
- How UCP and A2A protocols integrate with ADK
- The checkout state machine and commerce flows
Expand All @@ -22,16 +23,16 @@ This guide is for developers who want to understand how the sample works interna

Choose your path based on your goal:

| Goal | Start Here | Then Read |
|------|------------|-----------|
| **New to AI agents?** | [Glossary](docs/00-glossary.md) | This guide → 01-architecture |
| **Understand the system** | [Architecture](docs/01-architecture.md) | 02-adk-agent → 03-ucp-integration |
| **Add a new tool** | [ADK Agent](docs/02-adk-agent.md) | 06-extending |
| **Modify checkout flow** | [Commerce Flows](docs/04-commerce-flows.md) | 06-extending |
| **Customize the UI** | [Frontend](docs/05-frontend.md) | - |
| **Debug an issue** | [Testing Guide](docs/07-testing-guide.md) | - |
| **Deploy to production** | [Production Notes](docs/08-production-notes.md) | - |
| **Use AI assistant** | [SKILLS.md](SKILLS.md) | Context for Claude Code, Gemini CLI, Cursor, Codex |
| Goal | Start Here | Then Read |
| ------------------------- | ----------------------------------------------- | -------------------------------------------------- |
| **New to AI agents?** | [Glossary](docs/00-glossary.md) | This guide → 01-architecture |
| **Understand the system** | [Architecture](docs/01-architecture.md) | 02-adk-agent → 03-ucp-integration |
| **Add a new tool** | [ADK Agent](docs/02-adk-agent.md) | 06-extending |
| **Modify checkout flow** | [Commerce Flows](docs/04-commerce-flows.md) | 06-extending |
| **Customize the UI** | [Frontend](docs/05-frontend.md) | - |
| **Debug an issue** | [Testing Guide](docs/07-testing-guide.md) | - |
| **Deploy to production** | [Production Notes](docs/08-production-notes.md) | - |
| **Use AI assistant** | [SKILLS.md](SKILLS.md) | Context for Claude Code, Gemini CLI, Cursor, Codex |

## Architecture

Expand All @@ -44,39 +45,39 @@ Choose your path based on your goal:

### Key Files

| File | Purpose |
|------|---------|
| `business_agent/src/business_agent/agent.py` | ADK agent + 8 tools |
| `business_agent/src/business_agent/store.py` | Checkout state machine |
| `business_agent/src/business_agent/agent_executor.py` | A2A ↔ ADK bridge |
| `chat-client/App.tsx` | React app + A2A messaging |
| File | Purpose |
| ----------------------------------------------------- | ------------------------- |
| `business_agent/src/business_agent/agent.py` | ADK agent + 8 tools |
| `business_agent/src/business_agent/store.py` | Checkout state machine |
| `business_agent/src/business_agent/agent_executor.py` | A2A ↔ ADK bridge |
| `chat-client/App.tsx` | React app + A2A messaging |

### Endpoints

| Endpoint | Purpose |
|----------|---------|
| `GET /.well-known/agent-card.json` | A2A agent discovery |
| `GET /.well-known/ucp` | UCP merchant profile |
| `POST /` | A2A JSON-RPC endpoint |
| Endpoint | Purpose |
| ---------------------------------- | --------------------- |
| `GET /.well-known/agent-card.json` | A2A agent discovery |
| `GET /.well-known/ucp` | UCP merchant profile |
| `POST /` | A2A JSON-RPC endpoint |

### State Keys

| Key | Purpose |
|-----|---------|
| Key | Purpose |
| ------------------ | ------------------------ |
| `user:checkout_id` | Current checkout session |
| `__ucp_metadata__` | Negotiated capabilities |
| `__payment_data__` | Payment instrument |
| `__ucp_metadata__` | Negotiated capabilities |
| `__payment_data__` | Payment instrument |

## Deep Dive Guides

| Guide | Topics |
|-------|--------|
| [Glossary](docs/00-glossary.md) | Key terms, acronyms, state keys |
| [Architecture](docs/01-architecture.md) | System components, data flow |
| [ADK Agent](docs/02-adk-agent.md) | Tools, callbacks, session management |
| [UCP Integration](docs/03-ucp-integration.md) | Capabilities, profiles, negotiation |
| [Commerce Flows](docs/04-commerce-flows.md) | Checkout lifecycle, payment |
| [Frontend](docs/05-frontend.md) | React components, A2A client |
| [Extending](docs/06-extending.md) | Add tools, products, capabilities |
| [Testing Guide](docs/07-testing-guide.md) | Testing, debugging, troubleshooting |
| [Production Notes](docs/08-production-notes.md) | Security gaps, deployment checklist |
| Guide | Topics |
| ----------------------------------------------- | ------------------------------------ |
| [Glossary](docs/00-glossary.md) | Key terms, acronyms, state keys |
| [Architecture](docs/01-architecture.md) | System components, data flow |
| [ADK Agent](docs/02-adk-agent.md) | Tools, callbacks, session management |
| [UCP Integration](docs/03-ucp-integration.md) | Capabilities, profiles, negotiation |
| [Commerce Flows](docs/04-commerce-flows.md) | Checkout lifecycle, payment |
| [Frontend](docs/05-frontend.md) | React components, A2A client |
| [Extending](docs/06-extending.md) | Add tools, products, capabilities |
| [Testing Guide](docs/07-testing-guide.md) | Testing, debugging, troubleshooting |
| [Production Notes](docs/08-production-notes.md) | Security gaps, deployment checklist |
27 changes: 16 additions & 11 deletions a2a/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The sample uses **[Google ADK](https://google.github.io/adk-docs/)** (Agent Deve
</p>

**Key points:**

- **Client** sends requests with `UCP-Agent` header containing its profile URL
- **Cymbal Retail Agent** serves both `/.well-known/agent-card.json` (A2A) and `/.well-known/ucp` (UCP Profile)
- **Capability Negotiation** happens before processing - agent and client agree on supported features
Expand Down Expand Up @@ -86,12 +87,14 @@ uv run business_agent
```

**Expected output:**

```
INFO: Started server process
INFO: Uvicorn running on http://0.0.0.0:10999
```

This starts the Cymbal Retail Agent on port 10999. You can verify by accessing:

- **Agent Card:** http://localhost:10999/.well-known/agent-card.json
- **UCP Profile:** http://localhost:10999/.well-known/ucp

Expand Down Expand Up @@ -127,6 +130,7 @@ npm run dev
```

**Expected output:**

```
VITE v5.x.x ready
➜ Local: http://localhost:3000/
Expand Down Expand Up @@ -164,18 +168,19 @@ The Chat Client UCP Profile can be found at http://localhost:3000/profile/agent-

Ready to understand how it works?

| Goal | Resource |
|------|----------|
| **Understand the architecture** | [Developer Guide](DEVELOPER_GUIDE.md) |
| **Deep dive into code** | [Architecture](docs/01-architecture.md) |
| **Extend the sample** | [Extending Guide](docs/06-extending.md) |
| **AI assistant context** | [SKILLS.md](SKILLS.md) - Context for Claude Code, Gemini CLI, Cursor, Codex |
| Goal | Resource |
| ------------------------------- | --------------------------------------------------------------------------- |
| **Understand the architecture** | [Developer Guide](DEVELOPER_GUIDE.md) |
| **Deep dive into code** | [Architecture](docs/01-architecture.md) |
| **Extend the sample** | [Extending Guide](docs/06-extending.md) |
| **AI assistant context** | [SKILLS.md](SKILLS.md) - Context for Claude Code, Gemini CLI, Cursor, Codex |

## What is UCP?

**Universal Commerce Protocol (UCP)** is an open standard that enables interoperability between commerce platforms, merchants, and payment providers. It provides standardized data types for commerce transactions.

This sample uses the following UCP capabilities:

- `dev.ucp.shopping.checkout` - Checkout session management with status lifecycle: `incomplete` → `ready_for_complete` → `completed`
- `dev.ucp.shopping.fulfillment` - Shipping and delivery handling
- `dev.ucp.shopping.discount` - Discount and promotional codes
Expand All @@ -184,11 +189,11 @@ This sample uses the following UCP capabilities:

## Technology Stack

| Technology | Purpose | Used For |
|------------|---------|----------|
| **[Google ADK](https://google.github.io/adk-docs/)** | Agent Framework | AI agent with tools, Gemini LLM integration, session management |
| **[A2A Protocol](https://a2a-protocol.org/latest/)** | Communication | Agent discovery via Agent Card, JSON-RPC messaging, task management |
| **[UCP](https://ucp.dev)** | Commerce Standard | Standardized product, checkout, payment, and order data types |
| Technology | Purpose | Used For |
| ---------------------------------------------------- | ----------------- | ------------------------------------------------------------------- |
| **[Google ADK](https://google.github.io/adk-docs/)** | Agent Framework | AI agent with tools, Gemini LLM integration, session management |
| **[A2A Protocol](https://a2a-protocol.org/latest/)** | Communication | Agent discovery via Agent Card, JSON-RPC messaging, task management |
| **[UCP](https://ucp.dev)** | Commerce Standard | Standardized product, checkout, payment, and order data types |

## Related Resources

Expand Down
Loading