> ## Documentation Index
> Fetch the complete documentation index at: https://docs.budecosystem.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Publishing and calling an agent

> Publish an agent to the customer portal with a price, and call it from code.

## Publish an agent to the customer portal

## Publish with a price

**Who:** Model manage permission

**Where:** Agents → ⋯ → Publish

1. On the agent list, open the **⋯** menu and choose **Publish**.
2. Enter the price: **Input cost (USD)** (for example 0.50), **Output cost (USD)** (for example 1.50) and **Cost per**: 1K, 5K, 10K, 50K, 1M or 10M tokens.
3. Click **Publish**.

Customers then find the agent under **Agents** in the portal and call it with their own keys. **Publish Details** shows the current **Input Cost**, **Output Cost** and tokens per price, and the price history.

Publishing does not run any governance check. Attach and test your policies before you publish.

## Call the agent from code

Open **Use this agent** from the agent's **Home** tab or its row in the list. The **Code Snippet** tab gives cURL, Python and JavaScript for each endpoint with your agent's name and version filled in. A voice-enabled version adds the WebSocket addresses. See also **Call an agent** in [Calling models from your applications](https://docs.budecosystem.com/api-integration/calling-models.md).

### Responses API

Call `/v1/responses` with the agent's name as `prompt.id`. Add `prompt.version` in the body to pin a version; without it the default version answers. Put the agent's variables in `prompt.variables`.

```bash theme={null}
curl $BUD_BASE_URL/v1/responses \
  -H "Authorization: Bearer $BUD_API_KEY" -H "Content-Type: application/json" \
  -d '{"prompt": {"id": "claims-assistant", "version": "3",
                  "variables": {"customer_tier": "gold"}},
       "input": "Where is claim 4471?"}'
```

### Long runs in the background

Add `"background": true`. The call returns at once with a response in the `queued` state. Fetch it, or cancel it, using its `id`:

```bash theme={null}
curl -X POST $BUD_BASE_URL/v1/responses -H "Authorization: Bearer $BUD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": {"id": "claims-assistant"}, "input": "Review all open claims", "background": true}'

curl $BUD_BASE_URL/v1/responses/$RESPONSE_ID -H "Authorization: Bearer $BUD_API_KEY"
curl -X POST $BUD_BASE_URL/v1/responses/$RESPONSE_ID/cancel -H "Authorization: Bearer $BUD_API_KEY"
```

* Cancelling is only allowed on background responses; any other response returns 409. Cancelling twice is harmless.
* Background runs appear on the agent's **Runs** tab like any other, so you can watch, approve or stop them there ([Governing and supervising agents](https://docs.budecosystem.com/prompts-agents/governance.md)).
* You can only fetch and cancel responses created with your own key.

### Agent to agent (A2A)

Every agent version can be called by other agents and A2A clients over JSON-RPC at `/a2a/<agent>/v<N>/`. Use `v0` for the agent's default version. The methods are `message/send`, `message/stream`, `tasks/get` and `tasks/cancel`. The agent card is at `/a2a/<agent>/v0/.well-known/agent-card.json`.

```bash theme={null}
curl $BUD_BASE_URL/a2a/claims-assistant/v0/ \
  -H "Authorization: Bearer $BUD_API_KEY" -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": "1", "method": "message/send",
       "params": {"message": {"role": "user",
                  "parts": [{"kind": "text", "text": "Where is claim 4471?"}]}}}'
```

> [!WARNING]
>
> Responses and A2A calls use a project API key as a bearer token. Keep keys out of front-end code.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.