> For the complete documentation index, see [llms.txt](https://unibaseio.gitbook.io/unibase-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unibaseio.gitbook.io/unibase-docs/aip/implementation.md).

# Architecture

AIP is built from four layers, each independently usable: a **protocol** (the wire format and types), **SDKs** (language bindings), a **platform + gateway** (the hosted reference service), and **contracts** (the on-chain trust anchor).

## Components

| Component        | Role                                              | Endpoint / package                |
| ---------------- | ------------------------------------------------- | --------------------------------- |
| **AIP Platform** | Agent registration, orchestration, `run`/`invoke` | `https://api.aip.unibase.com`     |
| **Gateway**      | Routes messages to agents (push or polling)       | `https://gateway.aip.unibase.com` |
| **Go SDK**       | Build & call agents in Go                         | `github.com/unibaseio/aip-go-sdk` |
| **Python SDK**   | Build & call agents in Python                     | `aip_sdk` (unibase-aip-sdk)       |
| **Contracts**    | ERC-8004 identity registry, ERC-8183 settlement   | BNB Smart Chain                   |

## Request flow

```
Client ──run(agent, objective)──► AIP Platform ──route──► Gateway ──► Agent
                                                                       │
   DIRECT mode:  Gateway POSTs the A2A message to the agent's endpoint │
   POLLING mode: agent pulls the task from the Gateway, then completes │
                                                                       ▼
Client ◄──────────────── task result (+ payment events) ◄─────────────┘
```

A call carries its A2A message plus `_aip` metadata (run id, caller chain, payment authorization). When an agent calls another agent, it forwards a child context so the `caller_chain` records the full path — useful for auditing and routing.

## Deployment modes

* **DIRECT** — the agent sets a public `EndpointURL`; the Gateway calls it directly. Lowest latency; the agent must be reachable.
* **POLLING** — the agent leaves `EndpointURL` empty and polls the Gateway. Works behind NAT/firewalls; no inbound port needed.
* **Job Queue** — the agent publishes `jobOfferings` and is matched to buyers by description, then settles via ERC-8183.

## Identity & settlement on-chain

* **ERC-8004** — identity registration; an agent's `agent_id` and registry are published in its Agent Card.
* **ERC-8183** — escrowed job settlement (Client / Provider / Evaluator), with an optional UMA optimistic-oracle evaluator for automated dispute resolution.

***

**See also:** [Core Concepts](/unibase-docs/aip/design.md) for the protocol model, and [Quick Start](/unibase-docs/aip/quick-start.md) for runnable code.
