Skip to content

Commit 2fc5028

Browse files
docs sync
1 parent 75fb05a commit 2fc5028

6 files changed

Lines changed: 324 additions & 1220 deletions

File tree

AGENTS.md

Lines changed: 87 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,207 +1,176 @@
11
# AGENTS.md
22

3-
Instructions for AI agents and automation tools using the Extropy CLI.
3+
Operational guide for AI agents and automation tools using the Extropy CLI.
44

5-
## Agent Mode
5+
## Automation Mode
66

7-
Set agent mode for structured JSON output and non-interactive operation:
7+
Use agent mode for machine-readable output and non-interactive behavior:
88

99
```bash
1010
extropy config set cli.mode agent
1111
```
1212

13-
Or use the `--json` flag per-command:
14-
15-
```bash
16-
extropy results --json
17-
extropy query summary --json
18-
```
19-
20-
**Agent mode behavior:**
21-
22-
- All output is JSON (parseable, no ANSI formatting)
23-
- Exit codes indicate success/failure (0 = success, non-zero = error)
24-
- No interactive prompts — commands fail fast if missing required input
25-
- Clarification requests return exit code 2 with structured error
13+
Agent mode behavior:
14+
- JSON output shape from command handlers
15+
- deterministic exit codes
16+
- no interactive prompt loops (clarification requests return exit code `2`)
2617

2718
## CLI Pipeline
2819

2920
```bash
30-
extropy spec extropy scenario extropy persona extropy sample extropy network extropy simulate extropy results
21+
extropy spec -> extropy scenario -> extropy persona -> extropy sample -> extropy network -> extropy simulate -> extropy results
3122
```
3223

33-
34-
| Command | Purpose |
35-
| ---------- | ------------------------------------------------ |
36-
| `spec` | Create population spec from description |
37-
| `scenario` | Create scenario with events and outcomes |
38-
| `persona` | Generate persona rendering config |
39-
| `sample` | Sample agents from merged spec |
40-
| `network` | Generate social network |
41-
| `simulate` | Run simulation |
42-
| `results` | View results (summary, timeline, segment, agent) |
43-
| `query` | Export raw data (agents, edges, states, SQL) |
44-
| `chat` | Chat with simulated agents |
45-
| `estimate` | Predict simulation cost |
46-
| `validate` | Validate spec files |
47-
| `config` | View/set configuration |
48-
24+
| Command | Purpose |
25+
|---------|---------|
26+
| `spec` | Create/iterate `population.vN.yaml` |
27+
| `scenario` | Create/iterate `scenario/{name}/scenario.vN.yaml` |
28+
| `persona` | Generate `persona.vN.yaml` for a scenario |
29+
| `sample` | Sample agents from merged base + extended attributes |
30+
| `network` | Build social graph for sampled agents |
31+
| `simulate` | Run timestep simulation |
32+
| `results` | Read run outcomes (`summary`, `timeline`, `segment`, `agent`) |
33+
| `query` | Export/query raw DB-backed entities |
34+
| `chat` | Chat with simulated agents (`list`, `ask`) |
35+
| `validate` | Validate population/scenario/persona YAML |
36+
| `config` | View/set configuration |
4937

5038
## Non-Interactive Usage
5139

52-
### Pre-supplying answers
53-
54-
For `spec` command, use `--answers` to skip clarification prompts:
55-
56-
```bash
57-
extropy spec "German surgeons" -o surgeons --answers '{"location": "Bavaria"}'
58-
```
59-
60-
Or use `--use-defaults` to accept default values:
40+
### Pre-supply clarifications
6141

6242
```bash
43+
extropy spec "German surgeons" -o surgeons --answers '{"location":"Bavaria"}'
6344
extropy spec "German surgeons" -o surgeons --use-defaults
6445
```
6546

6647
### Skip confirmations
6748

68-
Use `-y` / `--yes` to skip confirmation prompts:
69-
7049
```bash
71-
extropy scenario "AI adoption" -o ai-adoption -y
72-
extropy persona -s ai-adoption -y
50+
extropy scenario "AI adoption in radiology" -o ai-radiology -y
51+
extropy persona -s ai-radiology -y
7352
```
7453

7554
## Exit Codes
7655

77-
78-
| Code | Meaning |
79-
| ---- | ---------------------------------- |
80-
| 0 | Success |
81-
| 1 | General error / validation failure |
82-
| 2 | Clarification needed (agent mode) |
83-
| 3 | File not found |
84-
| 4 | Sampling error |
85-
| 5 | Network error |
86-
| 6 | Simulation error |
87-
| 7 | Scenario error |
88-
| 10 | User cancelled |
89-
56+
| Code | Meaning |
57+
|------|---------|
58+
| `0` | Success |
59+
| `1` | Validation/general error |
60+
| `2` | Clarification required (agent mode) |
61+
| `3` | File/study/scenario not found |
62+
| `4` | Sampling error |
63+
| `5` | Network error |
64+
| `6` | Simulation error |
65+
| `7` | Scenario error |
66+
| `10` | User cancelled |
9067

9168
## Querying Data
9269

93-
Export raw data for downstream processing:
94-
9570
```bash
96-
# Agents as JSONL (auto-resolves scenario from latest run)
97-
extropy query agents --to agents.jsonl
98-
99-
# Explicit scenario
100-
extropy query agents -s congestion-tax --to agents.jsonl
71+
# study/entity summary
72+
extropy query summary
10173

102-
# Network edges
74+
# agents / edges / states export (JSONL)
75+
extropy query agents --to agents.jsonl
10376
extropy query edges --to edges.jsonl
104-
105-
# Simulation states
10677
extropy query states --to states.jsonl
10778

108-
# Arbitrary SQL (read-only)
109-
extropy query sql "SELECT * FROM agent_states WHERE aware = 1" --format json
79+
# read-only SQL
80+
extropy query sql "SELECT run_id, status FROM simulation_runs ORDER BY started_at DESC LIMIT 5" --format json
11081
```
11182

11283
## Chat API
11384

114-
Non-interactive chat for automation:
115-
11685
```bash
117-
extropy chat ask \
118-
--agent-id agent_042 \
119-
--prompt "What changed your mind?" \
120-
--json
121-
```
122-
123-
List available agents:
86+
# list recent runs and sample agents
87+
extropy chat list
12488

125-
```bash
126-
extropy chat list --json
89+
# non-interactive chat turn
90+
extropy chat ask --run-id <run_id> --agent-id <agent_id> --prompt "What changed your mind?"
12791
```
12892

129-
**Note:** The interactive REPL (`extropy chat`) requires a TTY and is not suitable for automation. Use `extropy chat ask` instead.
93+
Note: REPL chat mode is not for automation. Use `chat ask`.
13094

13195
## Configuration Keys
13296

13397
```bash
134-
extropy config set cli.mode agent # Enable agent mode globally
135-
extropy config set models.strong openai/gpt-5
136-
extropy config set models.fast openai/gpt-5-mini
137-
extropy config set simulation.strong anthropic/claude-sonnet-4-6
138-
extropy config set show_cost true # Show cost after commands
98+
# output behavior
99+
extropy config set cli.mode agent
100+
101+
# pipeline models (spec/scenario/persona)
102+
extropy config set models.fast anthropic/claude-sonnet-4-6
103+
extropy config set models.strong anthropic/claude-sonnet-4-6
104+
105+
# simulation models (reasoning/classification)
106+
extropy config set simulation.strong azure/gpt-5-mini
107+
extropy config set simulation.fast azure/gpt-5-mini
108+
109+
# runtime controls
110+
extropy config set simulation.rate_tier 2
111+
extropy config set show_cost true
139112
```
140113

141114
## Environment Variables
142115

143-
Required API keys (set at least one):
116+
Set at least one provider key used by your configured models:
144117

145118
```bash
146119
export OPENAI_API_KEY=sk-...
147120
export ANTHROPIC_API_KEY=sk-ant-...
148121
export OPENROUTER_API_KEY=sk-or-...
149122
export DEEPSEEK_API_KEY=sk-...
123+
124+
# Azure (supported names)
150125
export AZURE_API_KEY=...
151126
export AZURE_ENDPOINT=https://<resource>.services.ai.azure.com/
127+
# Legacy aliases still supported:
128+
# AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT
152129
```
153130

154131
## Global Flags
155132

156-
All commands accept:
157-
158-
159-
| Flag | Purpose |
160-
| -------------- | -------------------------------- |
161-
| `--json` | JSON output (overrides cli.mode) |
162-
| `--cost` | Show cost summary after command |
163-
| `--study PATH` | Explicit study folder path |
164-
133+
| Flag | Purpose |
134+
|------|---------|
135+
| `--version` | Print version and exit |
136+
| `--cost` | Show command cost footer |
137+
| `--study PATH` | Explicit study folder path |
165138

166139
## Study Folder Structure
167140

168141
```
169142
my-study/
170-
├── study.db # Canonical SQLite store
171-
├── population.v1.yaml # Base population spec
143+
├── study.db
144+
├── population.v1.yaml
172145
├── scenario/
173146
│ └── my-scenario/
174-
│ ├── scenario.v1.yaml # Scenario spec
175-
│ └── persona.v1.yaml # Persona config
147+
│ ├── scenario.v1.yaml
148+
│ └── persona.v1.yaml
176149
└── results/
177-
└── my-scenario/ # Simulation outputs
150+
└── my-scenario/
178151
```
179152

180153
## Typical Automation Flow
181154

182155
```bash
183-
# Create study folder and setup agent mode
156+
# 1) Create study + base population
184157
extropy spec "Austin TX commuters" -o my-study --use-defaults
185158
cd my-study
186159
extropy config set cli.mode agent
187160

188-
# Build scenario
189-
extropy scenario "Congestion tax response" -o congestion-tax -y
161+
# 2) Build scenario + persona
162+
extropy scenario "Congestion pricing response" -o congestion-tax -y
190163
extropy persona -s congestion-tax -y
191164

192-
# Sample agents and generate network (LLM config by default)
193-
extropy sample -s congestion-tax -n 500 --seed 42
194-
extropy network -s congestion-tax --seed 42
195-
196-
# Estimate before running
197-
extropy estimate -s congestion-tax --json
165+
# 3) Sample and network
166+
extropy sample -s congestion-tax -n 500 --seed 42 --strict-gates
167+
extropy network -s congestion-tax --seed 42 --quality-profile balanced --validate
198168

199-
# Run simulation
200-
extropy simulate -s congestion-tax --seed 42
169+
# 4) Simulate
170+
extropy simulate -s congestion-tax --seed 42 --fidelity medium
201171

202-
# Extract results
203-
extropy results --json
204-
extropy query agents --to agents.jsonl
172+
# 5) Read outputs
173+
extropy results -s congestion-tax summary
174+
extropy results -s congestion-tax timeline
205175
extropy query states --to states.jsonl
206176
```
207-

docs/commands.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,17 +762,17 @@ cd austin && extropy chat ask --prompt "What changed your mind?"
762762
|----------|-------------|
763763
| `OPENAI_API_KEY` | OpenAI API key |
764764
| `ANTHROPIC_API_KEY` | Anthropic (Claude) API key |
765-
| `AZURE_OPENAI_API_KEY` | Azure OpenAI API key |
765+
| `AZURE_API_KEY` | Azure API key (preferred) |
766+
| `AZURE_OPENAI_API_KEY` | Azure API key (legacy alias) |
766767
| `OPENROUTER_API_KEY` | OpenRouter API key |
767768
| `DEEPSEEK_API_KEY` | DeepSeek API key |
768769

769770
### Azure Configuration
770771

771772
| Variable | Default | Description |
772773
|----------|---------|-------------|
773-
| `AZURE_OPENAI_ENDPOINT` | | Azure OpenAI endpoint URL |
774-
| `AZURE_OPENAI_API_VERSION` | `2025-03-01-preview` | Azure API version |
775-
| `AZURE_OPENAI_DEPLOYMENT` | | Azure deployment name |
774+
| `AZURE_ENDPOINT` | | Azure endpoint URL (preferred) |
775+
| `AZURE_OPENAI_ENDPOINT` | | Azure endpoint URL (legacy alias) |
776776

777777
---
778778

0 commit comments

Comments
 (0)