> For the complete documentation index, see [llms.txt](https://docs.sidepit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sidepit.com/use-sidepit/beta/onboarding/authorize-agent.md).

# Authorize a Trading Agent

Give an AI agent a revocable trading identity without giving it the Bitcoin account key.

Delegation separates money authority from trading authority. The account owner keeps the UniSat key. The agent creates a different local key that may place and cancel orders for the account.

The delegated key cannot unlock Bitcoin, authorize another agent, or revoke an agent. Both the SDK and exchange enforce that boundary.

## 1. Prepare the public client

Clone the official repository with its protocol submodule and run the local tests:

```sh
git clone --recurse-submodules https://github.com/sidepit/Public-API
cd Public-API
python3 -m venv python-client/.venv
python-client/.venv/bin/pip install -r python-client/requirements.txt
python-client/.venv/bin/python -m pytest python-client/tests -q
```

Stop if any test fails.

## 2. Mint the agent identity locally

Only after the owner requests it, the agent runs one mint using the owner's complete public Sidepit ID:

```sh
cd python-client
.venv/bin/python -m sidepit_trader.agent_key new \
  --account "$SIDEPIT_ACCOUNT_ID"
cd ..
```

Set `SIDEPIT_ACCOUNT_ID` to the owner's complete public `bc1q` address. Never shorten it for a command, log, or approval screen.

The command writes one new `0600`, write-once agent file and prints public facts only. It must produce:

* a 66-character compressed public key beginning `02` or `03`;
* a derived `bc1q` agent ID different from the account ID; and
* the protected file path without displaying the private key.

Never source, print, paste, upload, overwrite, or transmit the contents of that file.

## 3. The owner authorizes the public key

In [app.sidepit.com](https://app.sidepit.com):

1. Connect the owner account in UniSat.
2. Under **Sidepit Account**, choose **Authorize trading agent**.
3. Paste the agent's 66-character public key.
4. Confirm the derived full agent Sidepit ID exactly matches the agent's public output.
5. Sign the authorization in UniSat.

<figure><img src="https://954013533-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0IyfR8sDr4geAO23BULo%2Fuploads%2Fgit-blob-d1f96836f2a9a78a8df855f21192927030d0fdb5%2Fsidepit-agents.png?alt=media" alt="Sidepit trading agents connected to the exchange"><figcaption><p>The owner keeps the money key; each agent receives a separate, revocable trading identity.</p></figcaption></figure>

<figure><img src="https://954013533-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0IyfR8sDr4geAO23BULo%2Fuploads%2Fgit-blob-90237369cdaa2905c4ee2ced7fa0e27c0964a19b%2Fplaceholder-agent.svg?alt=media" alt="Placeholder for the production Authorize trading agent dialog"><figcaption><p>Screenshot slot: show public-key entry, the complete derived agent Sidepit ID, and the owner-signature step.</p></figcaption></figure>

The account key remains inside the extension. The submitted receipt is not yet proof that the agent is active.

## 4. Verify ACTIVE

The agent checks settled server state with its protected path:

```sh
python-client/.venv/bin/python skills/sidepit-trade/scripts/sidepit_agent.py \
  delegate-status --key-file /absolute/path/to/agent.env
```

Do not trade until the result is `ACTIVE`. If it is `PENDING`, wait and check again rather than resubmitting.

On the wire, an authorized agent signs orders with the owner's `sidepit_id` and its own `agent_id`.

## Revoke or recover an agent

The owner can revoke an active agent from the same web interface. Revocation prevents future trading by that identity but does not erase existing positions or orders.

Losing the agent file does not lose the owner's Bitcoin. Revoke the lost agent ID and authorize a replacement. Any surviving copy can continue trading until the revocation becomes active.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sidepit.com/use-sidepit/beta/onboarding/authorize-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
