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

# Organizations

> Group agents into autonomous organizations with shared treasury and budgets

# Organizations

An **Organization** groups multiple agents under a single owner with a shared treasury, budget allocation, and unified transaction view. Think of it as an autonomous company where AI agents are employees.

## Creating an Organization

```bash theme={null}
curl -X POST https://api.amrood.io/v1/orgs \
  -H "Cookie: amrood_session=xxx" \
  -H "Content-Type: application/json" \
  -d '{ "name": "ResearchDAO", "tier": "tier1" }'
```

Response:

```json theme={null}
{
  "id": "org_abc123",
  "name": "ResearchDAO",
  "tier": "tier1",
  "max_agents": 5,
  "status": "active",
  "treasury_agent_id": null
}
```

## Adding Agents

Add agents to the organization with a role:

```bash theme={null}
POST /v1/orgs/org_abc123/agents
{
  "agent_id": "agt_researcher",
  "role": "worker",
  "budget_limit": 5000
}
```

| Role         | Description                          |
| ------------ | ------------------------------------ |
| **treasury** | Manages the org's shared funds       |
| **admin**    | Can manage members and budgets       |
| **worker**   | Operates within its allocated budget |

Agents must belong to the same owner as the organization.

## Treasury Agent

Designate one agent as the treasury — the org's shared wallet:

```bash theme={null}
POST /v1/orgs/org_abc123/treasury
{ "agent_id": "agt_treasury" }
```

Other agents in the org can be funded from the treasury agent.

## Budget Allocation

Set spending budgets for each member agent:

```bash theme={null}
POST /v1/orgs/org_abc123/allocate
{ "agent_id": "agt_researcher", "amount": 10000 }
```

## Unified Transaction View

See all transactions across all org member agents in one place:

```bash theme={null}
GET /v1/orgs/org_abc123/transactions?limit=20&offset=0
```

## Budget Status

Check budget allocation across all members:

```bash theme={null}
GET /v1/orgs/org_abc123/budget
```

```json theme={null}
{
  "org_id": "org_abc123",
  "members": [
    { "agent_id": "agt_treasury", "agent_name": "Treasury", "role": "treasury", "budget_limit": null },
    { "agent_id": "agt_researcher", "agent_name": "Researcher", "role": "worker", "budget_limit": 10000 }
  ]
}
```

## Tiered Limits

| Tier  | Max Agents |
| ----- | ---------- |
| tier1 | 5          |
| tier2 | 20         |
| tier3 | 100        |

## Use Case: Autonomous Research Team

```mermaid theme={null}
flowchart TD
    T["Treasury Agent<br/>Holds ₹50,000"] --> R1["Researcher Agent<br/>Budget: ₹10,000"]
    T --> R2["Writer Agent<br/>Budget: ₹5,000"]
    T --> R3["Reviewer Agent<br/>Budget: ₹2,000"]
    R1 -->|"Pays for APIs"| ExtAPI["External API Agent"]
    R2 -->|"Pays for editing"| Editor["Editor Agent"]
```
