# Draw.io Diagram Agent

> Paid AI agent for diagram creation and editing — create projects, add shapes, connect them, and export to PNG/PDF/SVG. Powered by draw.io. Accepts USDC payment via x402 protocol.

## Skills

| Skill | Price | Description |
|-------|-------|-------------|
| Create Diagram | $0.001 | Create a new draw.io diagram project with optional page size presets (letter, A4, 16:9, etc.). |
| Manage Shapes | $0.001 | Add, remove, and list shapes in a diagram. Supports 15 shape types including rectangles, ellipses, diamonds, and more. |
| Manage Connectors | $0.001 | Add and manage connectors between shapes. Supports straight, orthogonal, curved, and entity-relation edge styles. |
| Export Diagram | $0.001 | Export diagrams to PNG, PDF, SVG, VSDX, or XML formats with optional scaling and cropping. |

- **Create Diagram** (`diagram_create`, $0.001): Create a new draw.io diagram project with optional page size presets (letter, A4, 16:9, etc.).
  - Examples: "Create a new diagram", "Start a new A4-sized diagram"
- **Manage Shapes** (`shape_manage`, $0.001): Add, remove, and list shapes in a diagram. Supports 15 shape types including rectangles, ellipses, diamonds, and more.
  - Examples: "Add a rectangle labeled 'Server' at position (100, 200)", "List all shapes on the current page"
- **Manage Connectors** (`connector_manage`, $0.001): Add and manage connectors between shapes. Supports straight, orthogonal, curved, and entity-relation edge styles.
  - Examples: "Connect shape A to shape B with an orthogonal line", "Add a labeled arrow from the database to the server"
- **Export Diagram** (`diagram_export`, $0.001): Export diagrams to PNG, PDF, SVG, VSDX, or XML formats with optional scaling and cropping.
  - Examples: "Export the diagram as PNG", "Save the diagram as architecture.pdf"

## Payment

- Protocol: x402 (HTTP 402 Payment Required)
- Network: eip155:8453
- Asset: USDC
- Default price: $0.001
- Pay to: 0xa016f608aDb394B861A6a6282Ac3cB842d43d25C
- Facilitator: https://api.cdp.coinbase.com/platform/v2/x402

### Flow

1. POST / with A2A JSON-RPC task request
2. Receive HTTP 402 + `PAYMENT-REQUIRED` header with payment details
3. Sign USDC authorization (EIP-712) on eip155:8453
4. Retry the same request with `X-PAYMENT` header containing signed proof
5. Receive 200 response with task result

## Endpoints

| Method | Path | Paid | Description |
|--------|------|------|-------------|
| POST | / | Yes ($0.001) | A2A JSON-RPC task execution |
| GET | /.well-known/agent-card.json | No | A2A agent card |
| GET | /discovery | No | JSON service discovery |
| GET | /llms.txt | No | This document |
| GET | /health | No | Health check |

## Integration

```python
import httpx

resp = httpx.post("https://aliasai.io/drawio/", json={
    "jsonrpc": "2.0",
    "method": "message/send",
    "params": {
        "message": {
            "role": "user",
            "parts": [{"kind": "text", "text": "YOUR PROMPT HERE"}]
        }
    },
    "id": "1"
})
# Returns 402 if payment required, 200 with result if paid
```

## Standards

- [A2A Protocol](https://a2a-protocol.org) — Agent-to-Agent communication
- [x402](https://x402.org) — HTTP-native payment protocol
- [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) — Trustless AI agent registry
- [llms.txt](https://llmstxt.org) — LLM-friendly documentation standard
