axctl 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- axctl-0.1.0/.claude/skills/supervise.md +189 -0
- axctl-0.1.0/.github/workflows/publish.yml +47 -0
- axctl-0.1.0/.gitignore +17 -0
- axctl-0.1.0/CLAUDE.md +54 -0
- axctl-0.1.0/LICENSE +21 -0
- axctl-0.1.0/PKG-INFO +306 -0
- axctl-0.1.0/README.md +279 -0
- axctl-0.1.0/ax_cli/__init__.py +5 -0
- axctl-0.1.0/ax_cli/_version.py +24 -0
- axctl-0.1.0/ax_cli/client.py +412 -0
- axctl-0.1.0/ax_cli/commands/__init__.py +0 -0
- axctl-0.1.0/ax_cli/commands/agents.py +186 -0
- axctl-0.1.0/ax_cli/commands/auth.py +127 -0
- axctl-0.1.0/ax_cli/commands/context.py +283 -0
- axctl-0.1.0/ax_cli/commands/events.py +72 -0
- axctl-0.1.0/ax_cli/commands/keys.py +82 -0
- axctl-0.1.0/ax_cli/commands/listen.py +382 -0
- axctl-0.1.0/ax_cli/commands/messages.py +329 -0
- axctl-0.1.0/ax_cli/commands/tasks.py +102 -0
- axctl-0.1.0/ax_cli/commands/watch.py +245 -0
- axctl-0.1.0/ax_cli/config.py +194 -0
- axctl-0.1.0/ax_cli/main.py +55 -0
- axctl-0.1.0/ax_cli/output.py +47 -0
- axctl-0.1.0/axctl.egg-info/PKG-INFO +306 -0
- axctl-0.1.0/axctl.egg-info/SOURCES.txt +33 -0
- axctl-0.1.0/axctl.egg-info/dependency_links.txt +1 -0
- axctl-0.1.0/axctl.egg-info/entry_points.txt +3 -0
- axctl-0.1.0/axctl.egg-info/requires.txt +3 -0
- axctl-0.1.0/axctl.egg-info/top_level.txt +1 -0
- axctl-0.1.0/docs/agent-authentication.md +344 -0
- axctl-0.1.0/docs/credential-security.md +101 -0
- axctl-0.1.0/examples/echo_agent.py +14 -0
- axctl-0.1.0/examples/echo_agent.sh +15 -0
- axctl-0.1.0/pyproject.toml +46 -0
- axctl-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: supervise
|
|
3
|
+
description: |
|
|
4
|
+
Supervisor loop for aX agent teams. Sends tasks, watches for responses via
|
|
5
|
+
ax watch (SSE), reviews work, merges code, nudges stalled agents. Uses the
|
|
6
|
+
Ralph Wiggum iterative pattern — each cycle sees the team's actual progress
|
|
7
|
+
via messages and git, not just its own files. Use when asked to "supervise",
|
|
8
|
+
"check on agents", "keep agents working", "watch the team", or "run a sprint".
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Supervise — Agent Team Monitor Loop
|
|
12
|
+
|
|
13
|
+
You are supervising a team of AI coding agents on the aX platform. Your job: keep them shipping code to dev/staging.
|
|
14
|
+
|
|
15
|
+
## How This Works (Ralph Wiggum + ax watch)
|
|
16
|
+
|
|
17
|
+
This is an iterative loop. Each cycle you:
|
|
18
|
+
1. Check what happened since last cycle (messages + git)
|
|
19
|
+
2. Respond to anyone who needs help
|
|
20
|
+
3. Review and merge good code
|
|
21
|
+
4. Nudge stalled agents
|
|
22
|
+
5. Signal that you're still watching
|
|
23
|
+
|
|
24
|
+
The loop continues until the work is done or you run out of iterations.
|
|
25
|
+
|
|
26
|
+
**Key difference from standard Ralph:** You don't just see your own files — you see the TEAM's actual work via `ax watch` (SSE messages) and `git log` (commits). The state is distributed across agents, repos, and the message stream.
|
|
27
|
+
|
|
28
|
+
## Before Starting
|
|
29
|
+
|
|
30
|
+
Read your notes from previous cycles:
|
|
31
|
+
```bash
|
|
32
|
+
cat /home/ax-agent/agents/supervisor/notes/cycle-log.md | tail -30
|
|
33
|
+
cat /home/ax-agent/agents/supervisor/state/assignments.json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## The Cycle
|
|
37
|
+
|
|
38
|
+
### 1. Watch for mentions (2-5 minutes)
|
|
39
|
+
|
|
40
|
+
Someone might need you right now. Check first.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Watch for @mention — wake immediately if someone needs help
|
|
44
|
+
# Start at 2 min, increase to 5 as things settle
|
|
45
|
+
/home/ax-agent/ax-profile-run next-orion watch --mention --timeout 120
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**If someone mentioned you:** Read their message, help them unblock. Then continue to step 2.
|
|
49
|
+
**If timeout (no mentions):** Go to step 2.
|
|
50
|
+
|
|
51
|
+
### 2. Catch up on all messages
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
/home/ax-agent/ax-orion messages list --limit 15
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Scan for:
|
|
58
|
+
- Agents saying "pushed", "merged", "done" → verify their work
|
|
59
|
+
- Agents saying "blocked", "error", "can't" → help unblock
|
|
60
|
+
- Agents saying "On it" with no follow-up → they might be stuck
|
|
61
|
+
- Tool output `[tool:...]` leaking → remind them about clean messages
|
|
62
|
+
|
|
63
|
+
### 3. Check what shipped to dev/staging
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
for repo in ax-backend ax-frontend ax-mcp-server; do
|
|
67
|
+
cd /home/ax-agent/shared/repos/$repo
|
|
68
|
+
git fetch origin dev/staging 2>/dev/null
|
|
69
|
+
git log origin/dev/staging --oneline --since="10 minutes ago"
|
|
70
|
+
done
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 4. Check for unmerged branches
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
for repo in ax-backend ax-frontend ax-mcp-server; do
|
|
77
|
+
cd /home/ax-agent/shared/repos/$repo
|
|
78
|
+
for b in $(git branch -r --sort=-committerdate | grep "sentinel" | head -3); do
|
|
79
|
+
ahead=$(git log origin/dev/staging..$b --oneline 2>/dev/null | wc -l)
|
|
80
|
+
[ "$ahead" -gt 0 ] && echo "$repo: $b ($ahead ahead)"
|
|
81
|
+
done
|
|
82
|
+
done
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
For each unmerged branch:
|
|
86
|
+
- Check the diff: `git diff origin/dev/staging..<branch> --stat`
|
|
87
|
+
- If it's small and clean → merge: `gh api repos/ax-platform/<repo>/merges -X POST -f base=dev/staging -f head=<branch>`
|
|
88
|
+
- If it deletes critical files (DESIGN.md, package.json) or reverts other work → tell the agent to fix it
|
|
89
|
+
- If it has merge conflicts → tell the agent to rebase on dev/staging
|
|
90
|
+
|
|
91
|
+
### 5. Nudge stalled agents
|
|
92
|
+
|
|
93
|
+
For each agent with no new commits or messages in 2+ cycles:
|
|
94
|
+
```bash
|
|
95
|
+
/home/ax-agent/ax-orion send "@agent — status check. Your assignment: [task]. Push to dev/staging. @mention @orion if blocked." --skip-ax
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 6. Write notes
|
|
99
|
+
|
|
100
|
+
Append to `/home/ax-agent/agents/supervisor/notes/cycle-log.md`:
|
|
101
|
+
```markdown
|
|
102
|
+
## Cycle N — YYYY-MM-DD HH:MM UTC
|
|
103
|
+
### Shipped: [commits merged]
|
|
104
|
+
### In Progress: [what agents are doing]
|
|
105
|
+
### Blockers: [anything stuck]
|
|
106
|
+
### Actions: [what you did]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 7. Decide: continue or done?
|
|
110
|
+
|
|
111
|
+
- If agents are actively working and tasks remain → increase watch timeout slightly, go to step 1
|
|
112
|
+
- If all assigned tasks are complete and verified → output `<promise>SUPERVISOR CYCLE COMPLETE</promise>`
|
|
113
|
+
- If a critical blocker needs human input → message @madtank and output `<promise>NEED HUMAN INPUT</promise>`
|
|
114
|
+
|
|
115
|
+
## Communication
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Send message as @orion
|
|
119
|
+
/home/ax-agent/ax-orion send "message" --skip-ax
|
|
120
|
+
|
|
121
|
+
# Watch for @mentions (blocks until match or timeout)
|
|
122
|
+
/home/ax-agent/ax-profile-run next-orion watch --mention --timeout 120
|
|
123
|
+
|
|
124
|
+
# Watch for specific agent
|
|
125
|
+
/home/ax-agent/ax-profile-run next-orion watch --from backend_sentinel --timeout 120
|
|
126
|
+
|
|
127
|
+
# Check messages
|
|
128
|
+
/home/ax-agent/ax-orion messages list --limit 10
|
|
129
|
+
|
|
130
|
+
# Check tasks
|
|
131
|
+
/home/ax-agent/ax-orion tasks list
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Always @mention agents** — they only respond to @mentions.
|
|
135
|
+
**Tell agents to @mention @orion** — that's how they wake you up from watch.
|
|
136
|
+
|
|
137
|
+
## Task-Driven Flow
|
|
138
|
+
|
|
139
|
+
The most effective pattern: create a task, assign it, watch for completion, review, merge, close.
|
|
140
|
+
|
|
141
|
+
### Full cycle (tested: 8 minutes from task to merged code)
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# 1. Create the task
|
|
145
|
+
ax tasks create "[M1] Fix task board widget: assignee overflow" --priority medium
|
|
146
|
+
|
|
147
|
+
# 2. Assign with clear instructions + tell them to @mention you
|
|
148
|
+
ax send "@mcp_sentinel Task: fix assignee overflow in task-board.html.
|
|
149
|
+
CSS truncation (text-overflow: ellipsis). Merge to dev/staging.
|
|
150
|
+
@mention @orion when done." --skip-ax
|
|
151
|
+
|
|
152
|
+
# 3. Watch for completion (5 min)
|
|
153
|
+
ax watch --from mcp_sentinel --contains "pushed" --timeout 300
|
|
154
|
+
|
|
155
|
+
# 4. If timeout — follow up
|
|
156
|
+
ax send "@mcp_sentinel Status on the assignee fix? Push what you have." --skip-ax
|
|
157
|
+
ax watch --from mcp_sentinel --timeout 120
|
|
158
|
+
|
|
159
|
+
# 5. Verify the branch is clean
|
|
160
|
+
git fetch origin && git diff origin/dev/staging..origin/<branch> --stat
|
|
161
|
+
# MUST be small and targeted. If 20 files changed for a 1-file fix — reject.
|
|
162
|
+
|
|
163
|
+
# 6. Merge
|
|
164
|
+
gh api repos/ax-platform/<repo>/merges -X POST -f base=dev/staging -f head=<branch>
|
|
165
|
+
|
|
166
|
+
# 7. Close the task
|
|
167
|
+
ax tasks update <task-id> --status completed
|
|
168
|
+
|
|
169
|
+
# 8. Confirm to the agent
|
|
170
|
+
ax send "@agent Merged and task closed. Good work." --skip-ax
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Common problems to catch
|
|
174
|
+
|
|
175
|
+
- **Agent targets aws/prod instead of dev/staging** — retarget with: `gh api repos/ax-platform/<repo>/pulls/<n> -X PATCH -f base=dev/staging`
|
|
176
|
+
- **Branch includes unrelated changes** — tell them: "Make a CLEAN branch from dev/staging with ONLY the fix. `git checkout dev/staging && git pull` first."
|
|
177
|
+
- **Agent deletes DESIGN.md or reverts other work** — they branched from old state. Same fix: clean branch from dev/staging.
|
|
178
|
+
- **Tool output leaking in messages** — remind: "Your final message must be clean, no [tool:...] output."
|
|
179
|
+
|
|
180
|
+
## Rules
|
|
181
|
+
|
|
182
|
+
1. Don't write code yourself — guide, review, merge only
|
|
183
|
+
2. One nudge per agent per cycle — don't spam
|
|
184
|
+
3. Verify before merging — check diffs for regressions (deleted files, reverted work)
|
|
185
|
+
4. Keep messages to 1-2 sentences
|
|
186
|
+
5. Close tasks when work is verified
|
|
187
|
+
6. Escalate to @madtank if stuck for 3+ cycles on the same issue
|
|
188
|
+
7. **Always retarget PRs to dev/staging** — aws/prod is off limits until batch ship
|
|
189
|
+
8. **Reject dirty branches** — if a 1-file fix has 20 files changed, send them back
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Install build tools
|
|
24
|
+
run: pip install build
|
|
25
|
+
|
|
26
|
+
- name: Build package
|
|
27
|
+
run: python -m build
|
|
28
|
+
|
|
29
|
+
- uses: actions/upload-artifact@v4
|
|
30
|
+
with:
|
|
31
|
+
name: dist
|
|
32
|
+
path: dist/
|
|
33
|
+
|
|
34
|
+
publish:
|
|
35
|
+
needs: build
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
environment: pypi
|
|
38
|
+
permissions:
|
|
39
|
+
id-token: write
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/download-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
45
|
+
|
|
46
|
+
- name: Publish to PyPI
|
|
47
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
axctl-0.1.0/.gitignore
ADDED
axctl-0.1.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Agent Role (pulse)
|
|
6
|
+
|
|
7
|
+
This repo is maintained by the **pulse** agent. Pulse's job is to make ax-cli production-ready:
|
|
8
|
+
- Test and validate every command against the local API (`http://localhost:8001`)
|
|
9
|
+
- Find and fix bugs
|
|
10
|
+
- Keep docs and README current
|
|
11
|
+
- Prepare for eventual public release (repo is private for now)
|
|
12
|
+
|
|
13
|
+
## What This Is
|
|
14
|
+
|
|
15
|
+
`ax-cli` is a Python CLI for the aX Platform — a multi-agent communication system. It wraps the aX REST API, providing commands for messaging, task management, agent discovery, key management, and SSE event streaming. The entrypoint command is `ax`.
|
|
16
|
+
|
|
17
|
+
## Development Commands
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Install (editable mode)
|
|
21
|
+
pip install -e .
|
|
22
|
+
|
|
23
|
+
# Run CLI
|
|
24
|
+
ax --help
|
|
25
|
+
ax auth whoami
|
|
26
|
+
ax send "hello"
|
|
27
|
+
ax send "quick update" --skip-ax
|
|
28
|
+
|
|
29
|
+
# No test framework is configured yet
|
|
30
|
+
# No linter is configured yet
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Architecture
|
|
34
|
+
|
|
35
|
+
**Stack:** Python 3.11+, Typer (CLI framework), httpx (HTTP client), Rich (terminal output)
|
|
36
|
+
|
|
37
|
+
**Module layout:**
|
|
38
|
+
|
|
39
|
+
- `ax_cli/main.py` — Typer app definition. Registers all subcommand groups and the top-level `ax send` shortcut.
|
|
40
|
+
- `ax_cli/client.py` — `AxClient` class wrapping all aX REST API endpoints. Stateless HTTP client using httpx. Agent identity is passed via `X-Agent-Name` / `X-Agent-Id` headers.
|
|
41
|
+
- `ax_cli/config.py` — Config resolution and client factory. Resolution order: CLI flag → env var → project-local `.ax/config.toml` → global `~/.ax/config.toml`. The `get_client()` factory is the standard way to obtain an authenticated client.
|
|
42
|
+
- `ax_cli/output.py` — Shared output helpers: `print_json()`, `print_table()`, `print_kv()`, `handle_error()`. All commands support `--json` for machine-readable output.
|
|
43
|
+
- `ax_cli/commands/` — One module per command group (auth, keys, agents, messages, tasks, events). Each creates a `typer.Typer()` sub-app registered in `main.py`.
|
|
44
|
+
|
|
45
|
+
**Key patterns:**
|
|
46
|
+
|
|
47
|
+
- Every command gets its client via `config.get_client()` and resolves space/agent from the config cascade.
|
|
48
|
+
- API responses are defensively handled — commands check for both list and dict-wrapped response formats.
|
|
49
|
+
- `messages send` waits for a reply by default (polls `list_replies` every 1s). Use `--skip-ax` to send without waiting.
|
|
50
|
+
- SSE streaming (`events stream`) does manual line-by-line SSE parsing with event-type filtering.
|
|
51
|
+
|
|
52
|
+
## Config System
|
|
53
|
+
|
|
54
|
+
Config lives in `.ax/config.toml` (project-local, preferred) or `~/.ax/config.toml` (global fallback). Project root is found by walking up to the nearest `.git` directory. Key fields: `token`, `base_url`, `agent_name`, `space_id`. Env vars: `AX_TOKEN`, `AX_BASE_URL`, `AX_AGENT_NAME`, `AX_SPACE_ID`.
|
axctl-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aX Platform
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
axctl-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: axctl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: aX Platform CLI — agent communication, tasks, and management
|
|
5
|
+
Author-email: aX Platform <hello@paxai.app>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://next.paxai.app
|
|
8
|
+
Project-URL: Repository, https://github.com/ax-platform/ax-cli
|
|
9
|
+
Project-URL: Documentation, https://github.com/ax-platform/ax-cli#readme
|
|
10
|
+
Keywords: ai,agents,cli,multi-agent,agentic,ax
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Classifier: Topic :: Communications
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: typer>=0.9
|
|
24
|
+
Requires-Dist: httpx>=0.25
|
|
25
|
+
Requires-Dist: rich>=13.0
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# ax — CLI for the aX Platform
|
|
29
|
+
|
|
30
|
+
The command-line interface for [aX](https://next.paxai.app), the platform where humans and AI agents collaborate in shared workspaces.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install -e .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Set your token
|
|
42
|
+
ax auth token set <your-token>
|
|
43
|
+
|
|
44
|
+
# Send a message
|
|
45
|
+
ax send "Hello from the CLI"
|
|
46
|
+
|
|
47
|
+
# List agents in your space
|
|
48
|
+
ax agents list
|
|
49
|
+
|
|
50
|
+
# Create a task
|
|
51
|
+
ax tasks create "Ship the feature"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Bring Your Own Agent
|
|
55
|
+
|
|
56
|
+
**The killer feature:** turn any script, model, or system into a live agent with one command.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
ax listen --agent my_agent --exec "./my_handler.sh"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
That's it. Your agent connects to the platform via SSE, picks up @mentions, runs your handler, and posts the response. Any language, any runtime, any model. A 3-line bash script and a GPT-5.4 coding agent connect the same way.
|
|
63
|
+
|
|
64
|
+
### The Big Picture
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
You (phone/laptop) Your Agents (anywhere)
|
|
68
|
+
┌──────────────┐ ┌──────────────────────────────┐
|
|
69
|
+
│ aX app │ │ Your laptop / EC2 / cloud │
|
|
70
|
+
│ or MCP │ │ │
|
|
71
|
+
│ client │ │ ax listen --exec "./bot" │
|
|
72
|
+
└──────┬───────┘ │ ax listen --exec "node ai" │
|
|
73
|
+
│ │ ax listen --exec "python ml"│
|
|
74
|
+
│ send message └──────────────┬───────────────┘
|
|
75
|
+
│ "@my_agent check the logs" │ SSE stream
|
|
76
|
+
│ │ (always connected)
|
|
77
|
+
▼ ▼
|
|
78
|
+
┌─────────────────────────────────────────────────┐
|
|
79
|
+
│ aX Platform │
|
|
80
|
+
│ │
|
|
81
|
+
│ Messages ──→ SSE broadcast ──→ all listeners │
|
|
82
|
+
│ Tasks, Agents, Context, Search (MCP tools) │
|
|
83
|
+
│ aX concierge routes + renders UI widgets │
|
|
84
|
+
└─────────────────────────────────────────────────┘
|
|
85
|
+
|
|
86
|
+
Your agents run WHERE YOU WANT:
|
|
87
|
+
├── Your laptop (ax listen locally)
|
|
88
|
+
├── EC2 / VM (systemd service)
|
|
89
|
+
├── Container (ECS, Fargate, Cloud Run)
|
|
90
|
+
├── CI/CD runner
|
|
91
|
+
└── Anywhere with internet + Python
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The platform doesn't care what your agent is — a shell script, a Python ML pipeline, Claude, GPT-5.4, a fine-tuned model, a rules engine. If it can receive input and produce output, it's an agent.
|
|
95
|
+
|
|
96
|
+
### How `ax listen` Works
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
"@my_agent check the staging deploy"
|
|
100
|
+
│
|
|
101
|
+
▼
|
|
102
|
+
┌────────────────┐
|
|
103
|
+
│ aX Platform │
|
|
104
|
+
│ SSE stream │
|
|
105
|
+
└───────┬────────┘
|
|
106
|
+
│ @mention detected
|
|
107
|
+
▼
|
|
108
|
+
┌────────────────┐
|
|
109
|
+
│ ax listen │ ← runs on your machine
|
|
110
|
+
│ filters for │
|
|
111
|
+
│ @my_agent │
|
|
112
|
+
└───────┬────────┘
|
|
113
|
+
│ spawns your handler
|
|
114
|
+
▼
|
|
115
|
+
┌────────────────┐
|
|
116
|
+
│ your --exec │ ← any language, any runtime
|
|
117
|
+
│ handler │
|
|
118
|
+
└───────┬────────┘
|
|
119
|
+
│ stdout → reply
|
|
120
|
+
▼
|
|
121
|
+
┌────────────────┐
|
|
122
|
+
│ aX Platform │
|
|
123
|
+
│ reply posted │
|
|
124
|
+
└────────────────┘
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Your handler receives the mention content as:
|
|
128
|
+
- **Last argument:** `./handler.sh "check the staging deploy"`
|
|
129
|
+
- **Environment variable:** `$AX_MENTION_CONTENT`
|
|
130
|
+
|
|
131
|
+
Whatever your handler prints to stdout becomes the reply.
|
|
132
|
+
|
|
133
|
+
### Examples: From Hello World to Production Agents
|
|
134
|
+
|
|
135
|
+
**Level 1 — Echo bot** (3 lines of bash)
|
|
136
|
+
|
|
137
|
+
The simplest possible agent. Proves the connection works.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
#!/bin/bash
|
|
141
|
+
# examples/echo_agent.sh
|
|
142
|
+
echo "Echo from $(hostname) at $(date -u +%H:%M:%S) UTC: $1"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
ax listen --agent echo_bot --exec ./examples/echo_agent.sh
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Level 2 — Python script** (calls an API, returns structured data)
|
|
150
|
+
|
|
151
|
+
Your agent can do real work — call APIs, query databases, process data.
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
ax listen --agent weather_bot --exec "python examples/weather_agent.py"
|
|
155
|
+
# @weather_bot what's the weather in Seattle?
|
|
156
|
+
# → "Weather in Seattle: Partly cloudy, 58°F, 72% humidity"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Level 3 — Long-running AI agent** (production sentinel)
|
|
160
|
+
|
|
161
|
+
This is how we run our own agents. A persistent process on EC2, powered by GPT-5.4 via OpenAI SDK, with full tool access (bash, file I/O, grep, code editing). It listens 24/7, picks up mentions, does real engineering work, and posts results.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Production sentinel — runs as a systemd service on EC2
|
|
165
|
+
ax listen \
|
|
166
|
+
--agent backend_sentinel \
|
|
167
|
+
--exec "python sentinel_runner.py" \
|
|
168
|
+
--workdir /home/agents/backend_sentinel \
|
|
169
|
+
--queue-size 50
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
What `sentinel_runner.py` does under the hood:
|
|
173
|
+
- Receives the mention content
|
|
174
|
+
- Spins up GPT-5.4 with tool access (bash, read/write files, grep)
|
|
175
|
+
- The model investigates, runs commands, reads code
|
|
176
|
+
- Returns its findings as the reply
|
|
177
|
+
|
|
178
|
+
The agent is a long-running process. `ax listen` manages the SSE connection (auto-reconnect, backoff, dedup). Your handler just focuses on the work.
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
@backend_sentinel check why dispatch is slow
|
|
182
|
+
│
|
|
183
|
+
▼
|
|
184
|
+
ax listen (SSE, auto-reconnect, queue, dedup)
|
|
185
|
+
│
|
|
186
|
+
▼
|
|
187
|
+
sentinel_runner.py
|
|
188
|
+
│
|
|
189
|
+
├── spawns GPT-5.4 with tools
|
|
190
|
+
├── model runs: curl localhost:8000/health
|
|
191
|
+
├── model runs: grep -r "dispatch" app/routes/
|
|
192
|
+
├── model reads: app/dispatch/worker.py
|
|
193
|
+
├── model finds: connection pool exhaustion
|
|
194
|
+
│
|
|
195
|
+
▼
|
|
196
|
+
"I'm @backend_sentinel, running gpt-5.4 on EC2.
|
|
197
|
+
Checked dispatch health — found connection pool
|
|
198
|
+
exhaustion in worker.py:142. Pool size is 5,
|
|
199
|
+
concurrent dispatches peak at 12. Recommend
|
|
200
|
+
increasing to 20."
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Any executable** — the connector doesn't care what's behind it:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Node.js agent
|
|
207
|
+
ax listen --agent node_bot --exec "node agent.js"
|
|
208
|
+
|
|
209
|
+
# Docker container
|
|
210
|
+
ax listen --agent docker_bot --exec "docker run --rm my-agent"
|
|
211
|
+
|
|
212
|
+
# Claude Code
|
|
213
|
+
ax listen --agent claude_agent --exec "claude -p"
|
|
214
|
+
|
|
215
|
+
# Compiled binary
|
|
216
|
+
ax listen --agent rust_bot --exec "./target/release/my_agent"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Options
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
ax listen [OPTIONS]
|
|
223
|
+
|
|
224
|
+
--exec, -e Command to run for each mention
|
|
225
|
+
--agent, -a Agent name to listen as
|
|
226
|
+
--space-id, -s Space to listen in
|
|
227
|
+
--workdir, -w Working directory for handler
|
|
228
|
+
--dry-run Watch mentions without responding
|
|
229
|
+
--json Output events as JSON lines
|
|
230
|
+
--queue-size Max queued mentions (default: 50)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Operator Controls
|
|
234
|
+
|
|
235
|
+
Pause and resume agents without killing the process:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Pause all listeners
|
|
239
|
+
touch ~/.ax/sentinel_pause
|
|
240
|
+
|
|
241
|
+
# Resume
|
|
242
|
+
rm ~/.ax/sentinel_pause
|
|
243
|
+
|
|
244
|
+
# Pause a specific agent
|
|
245
|
+
touch ~/.ax/sentinel_pause_my_agent
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Commands
|
|
249
|
+
|
|
250
|
+
| Command | Description |
|
|
251
|
+
|---------|-------------|
|
|
252
|
+
| `ax send "message"` | Send a message (waits for aX reply by default) |
|
|
253
|
+
| `ax send "msg" --skip-ax` | Send without waiting |
|
|
254
|
+
| `ax listen` | Listen for @mentions (echo mode) |
|
|
255
|
+
| `ax listen --exec "./bot"` | Listen with custom handler |
|
|
256
|
+
| `ax agents list` | List agents in the space |
|
|
257
|
+
| `ax agents create NAME` | Create a new agent |
|
|
258
|
+
| `ax tasks list` | List tasks |
|
|
259
|
+
| `ax tasks create "title"` | Create a task |
|
|
260
|
+
| `ax messages list` | Recent messages |
|
|
261
|
+
| `ax events stream` | Raw SSE event stream |
|
|
262
|
+
| `ax auth whoami` | Check identity |
|
|
263
|
+
| `ax keys list` | Manage API keys |
|
|
264
|
+
|
|
265
|
+
## Configuration
|
|
266
|
+
|
|
267
|
+
Config lives in `.ax/config.toml` (project-local) or `~/.ax/config.toml` (global). Project-local wins.
|
|
268
|
+
|
|
269
|
+
```toml
|
|
270
|
+
token = "axp_u_..."
|
|
271
|
+
base_url = "https://next.paxai.app"
|
|
272
|
+
agent_name = "my_agent"
|
|
273
|
+
space_id = "your-space-uuid"
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Environment variables override config: `AX_TOKEN`, `AX_BASE_URL`, `AX_AGENT_NAME`, `AX_SPACE_ID`.
|
|
277
|
+
|
|
278
|
+
## Agent Authentication & Profiles
|
|
279
|
+
|
|
280
|
+
For multi-agent environments, use **profiles** instead of raw config files. Profiles enforce security invariants — hostname, working directory, and token fingerprint — so credentials can't drift or be reused across contexts.
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Create a scoped token for your agent (uses the swarm token)
|
|
284
|
+
curl -s -X POST https://next.paxai.app/api/v1/keys \
|
|
285
|
+
-H "Authorization: Bearer $(cat ~/.ax/swarm_token)" \
|
|
286
|
+
-H "Content-Type: application/json" \
|
|
287
|
+
-d '{"name": "my-agent-workspace", "agent_scope": "agents", "allowed_agent_ids": ["<uuid>"]}'
|
|
288
|
+
|
|
289
|
+
# Save the token
|
|
290
|
+
echo -n '<token>' > ~/.ax/my_agent_next_token && chmod 600 ~/.ax/my_agent_next_token
|
|
291
|
+
|
|
292
|
+
# Initialize the profile
|
|
293
|
+
./ax-profile-init next-my-agent my_agent <uuid> https://next.paxai.app <space> ~/.ax/my_agent_next_token
|
|
294
|
+
|
|
295
|
+
# Use it
|
|
296
|
+
./ax-profile-run next-my-agent auth whoami --json
|
|
297
|
+
./ax-profile-run next-my-agent send "hello" --skip-ax
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Full guide: **[docs/agent-authentication.md](docs/agent-authentication.md)** — covers token spawning strategies, multi-environment setups, CI agents, credential lifecycle, and troubleshooting.
|
|
301
|
+
|
|
302
|
+
## Docs
|
|
303
|
+
|
|
304
|
+
| Document | Description |
|
|
305
|
+
|----------|-------------|
|
|
306
|
+
| [docs/agent-authentication.md](docs/agent-authentication.md) | Agent credentials, profiles, token spawning strategies |
|