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

# 2. Build it

> Run order-support on your machine with no DecimalAI account, then add a key: the agent appears in your dashboard, every run is traced, and you change its prompt without redeploying.

You'll run the agent from [Part 1](https://docs.decimal.ai/tutorials/support-agent/try-it.md) on your own machine, first with no DecimalAI account, then connected to it. The code stays the same throughout. This part uses the OpenAI Agents SDK; the [OpenAI Agents SDK page](https://docs.decimal.ai/sdk/python/frameworks/openai-agents.md) has the reference for everything here.

You need Python 3.10 or later and an OpenAI API key.

## 1. Install

```bash theme={null}
mkdir order-support && cd order-support
git init
python -m venv .venv && source .venv/bin/activate
pip install "decimalai[openai-agents]"
echo 'OPENAI_API_KEY=sk-...' >> .env
```

`decimalai` reads `.env` when it is imported. Work in a git repository: step 4 writes a file to commit.

## 2. Add the three skills

Add the agent's three skills from the registry, `billing-dispute-resolution`, `account-deletion-verification-policy` and `diagnostic-triage-questions`:

```bash theme={null}
decimalai skills add billing-dispute-resolution
decimalai skills add account-deletion-verification-policy
decimalai skills add diagnostic-triage-questions
```

Each command writes the skill's files to `.agents/skills/`, lists it in `.decimal/skills.toml`, and records its exact bytes in `.decimal/skills.lock`. No account is needed. Commit both directories:

```bash theme={null}
git add .decimal .agents && git commit -m "order-support's skills"
```

## 3. Run it with no DecimalAI account

Save this as `main.py`:

```python main.py theme={null}
from agents import Agent, Runner, function_tool
from decimalai.openai_agents import agent_config

ORDERS = {
    "ORD-1001": {"item": "electric kettle", "status": "delivered 2026-10-20", "charges": ["$49.00 on 2026-10-15"]},
    "ORD-1002": {"item": "mechanical keyboard", "status": "delivered 2026-10-18", "charges": ["$129.00 on 2026-10-12", "$129.00 on 2026-10-12"]},
}


@function_tool
def lookup_order(order_id: str) -> str:
    """Look up an order by its id, for example ORD-1002."""
    return str(ORDERS.get(order_id, "No order with that id."))


support = agent_config(
    "order-support",
    fallback="You are Acme's order support agent. Look the order up before you answer.",
)

agent = Agent(
    name=support.name,
    instructions=support.instructions,     # the prompt, then the skill list
    tools=[lookup_order, *support.tools],  # your tools, then load_skill
)
result = Runner.run_sync(agent, "I was charged twice for order ORD-1002. Can you fix it?")
print(result.final_output)
```

```bash theme={null}
python main.py
```

With no `DECIMAL_API_KEY`, `agent_config()` runs keyless and says so once:

```text theme={null}
decimalai: no DECIMAL_API_KEY, so agent 'order-support' runs keyless: no traces, and its skills are the ones .decimal/skills.toml lists (`decimalai skills add <name>` adds one). Add DECIMAL_API_KEY to connect it.
```

Then the agent's reply. What happened is what [Part 1](https://docs.decimal.ai/tutorials/support-agent/try-it.md) showed:

* **`instructions=support.instructions`** gives the model the `fallback=` prompt, then the skill menu: the three skills' names and descriptions, and a sentence telling it to load a skill before using it.
* **`*support.tools`** adds one tool, `load_skill`. The model calls it with a skill's name and gets that skill's full instructions back, read from `.agents/skills/`.
* **`lookup_order`** is your own tool. Here it reads a dictionary; in your app it reads your database.
* **Nothing is sent to DecimalAI.** No account, no traces.

Change the question to `"Please delete my account and all my data today."` and run it again. The model loads `account-deletion-verification-policy` instead.

## 4. Add a DecimalAI key

Sign up at [app.decimal.ai](https://app.decimal.ai), get a key from **Settings → API Key**, and add it to the same `.env`:

```bash theme={null}
echo 'DECIMAL_API_KEY=dai_sk_...' >> .env
```

Run `main.py` again, unchanged. Its first run connects the project (example output):

```text theme={null}
decimalai: created agent 'order-support' in your DecimalAI workspace.
decimalai: connected agent 'order-support' to your DecimalAI workspace: copied billing-dispute-resolution (latest), account-deletion-verification-policy (latest), diagnostic-triage-questions (latest) onto it. From now on its skills live on DecimalAI: change them in the dashboard or with `decimalai skills add`; editing .decimal/skills.toml no longer changes them. Wrote .decimal/link.toml: commit it.
```

```bash theme={null}
git add .decimal/link.toml && git commit -m "Connect order-support"
```

What changed:

* **The agent exists in your workspace**, at [app.decimal.ai/agents/order-support](https://app.decimal.ai/agents/order-support). It has no saved prompt yet, so the `fallback=` text keeps running.
* **Its skills were copied onto it, once.** From now on they live on DecimalAI: you change them in the dashboard or with `decimalai skills add`, and editing `.decimal/skills.toml` no longer does.
* **Every run is traced** from now on: the model calls, `lookup_order`, `load_skill`, and the prompt and skills the run used. Runs from before the key are not uploaded.
* **`.decimal/link.toml`** records the connection. With it committed, `agent_config()` with no key raises an error instead of running keyless, so a deploy that lost its key fails at startup instead of running without its saved prompt.

## 5. Change the prompt without redeploying

Open the agent in the dashboard. On its **Prompt** tab, write a prompt and save it:

```text theme={null}
You are Acme's order support agent. Look the order up before you answer.
Keep replies under 120 words and sign them "— Acme Support".
```

Run `main.py` again within a minute or so. The reply is signed: `agent_config()` re-reads the saved prompt in the background at most once a minute, so it reaches the next runs with no redeploy. `support.prompt_source` is now `"decimalai"`.

`fallback=` still matters: with a key, it is what runs when the agent has no saved prompt, or when DecimalAI can't be reached at startup.

> **[Next: 3. Start from a template](https://docs.decimal.ai/tutorials/support-agent/start-from-a-template.md)**
>
> Give order-support the Support pack's prompt and five more skills, then make one skill your own.


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