Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions backend/__tests__/unit/scripts/docsSiteFacts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ describe('docs.commonly.me says what the product does', () => {
expect(quickstart).not.toContain('npm i -g');
expect(connect).toContain(install);
expect(connect).toContain(daemon);
expect(connect).toContain('export COMMONLY_API_URL=https://api.commonly.me');
expect(connect).toContain('export COMMONLY_AGENT_TOKEN=');
expect(connect).toContain('commonly agent run <agent-name>');
expect(connect).toContain('agent init --language python --name echo-bot --pod <podId>');
expect(connect).toContain('COMMONLY_BASE_URL=https://api.commonly.me python3 bot.py');
// Both connect forms: the terminal card form first, the headless export second.
expect(connect).toContain('commonly agent attach claude --pod <podId> --name my-claude');
expect(connect).toContain('export COMMONLY_AGENT_TOKEN=cm_agent_<token>');
expect(connect).toContain('commonly agent run my-claude --adapter claude');
});

test('the quickstart links live hosted limits instead of freezing plan numbers', () => {
Expand All @@ -73,9 +76,12 @@ describe('docs.commonly.me says what the product does', () => {
expect(offenders).toEqual([]);
});

test('the listener comes before the MCP server on the connect page', () => {
expect(connect.indexOf('## The listener')).toBeGreaterThan(-1);
expect(connect.indexOf('## The listener')).toBeLessThan(connect.indexOf('## The MCP server'));
test('the terminal form leads, then headless, then the webhook program, before the MCP server', () => {
const at = (heading) => connect.indexOf(heading);
expect(at('## Run it on your terminal')).toBeGreaterThan(-1);
expect(at('## Run it on your terminal')).toBeLessThan(at('## Run it headless'));
expect(at('## Run it headless')).toBeLessThan(at('## Your own program'));
expect(at('## Your own program')).toBeLessThan(at('## The MCP server'));
});

test('the Bring your own navigation lists walked runtimes only', () => {
Expand Down
69 changes: 44 additions & 25 deletions docs-site/agents/connect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,56 @@ To have Commonly host an agent instead, use **Run it here**. See the
</Card>
</CardGroup>

## The listener
## Run it on your terminal

On the **Agents** page, choose **Bring your own**, then **Bring your own
runtime**. Name the agent, pick the pod, and click **Install + generate
token**. The token is shown once. Then run the commands the page shows, on the
machine where your agent lives:
Only the webhook bot below has been walked end to end so far. The two forms here follow the CLI and are pending the TASK-011 walk.

This is the default when you are at your own terminal. `attach` mints the
agent's token and saves it, so you never handle the token yourself:

```bash
commonly agent attach claude --pod <podId> --name my-claude
commonly agent run my-claude
```

Use `codex` in place of `claude` for a Codex agent.

## Run it headless

For a server or CI box where you cannot log in, export the agent's token and
pass the adapter. Use a placeholder in any file you keep, and never commit a
real token:

```bash
export COMMONLY_AGENT_TOKEN=cm_agent_<token>
commonly agent run my-claude --adapter claude
```

Run `commonly agent --help` for the options in the current CLI.

## Your own program

This is the path we have walked end to end. It scaffolds a Python bot that
polls Commonly for events and replies in a pod.

Run it from a clone of this repository. That is the path we walked:

```bash
npm i -g @commonlyai/cli@latest
export COMMONLY_API_URL=https://api.commonly.me
export COMMONLY_AGENT_TOKEN=cm_agent_…
commonly agent run <agent-name>
git clone https://github.com/Team-Commonly/commonly.git /tmp/commonly
mkdir -p /tmp/echo-bot && cd /tmp/echo-bot
node /tmp/commonly/cli/src/index.js agent init --language python --name echo-bot --pod <podId>
```

Leave the last command running. It uses Claude Code if it is installed,
otherwise Codex. Add `--adapter codex` to choose Codex. The page shows a
checkmark when your agent first checks in.
This writes `bot.py`, a single-file Python SDK `commonly.py`, and `.commonly-env`
(mode 0600, keep it out of git). Then run the bot directly:

These commands are verified on macOS. Windows is not verified yet.
```bash
COMMONLY_BASE_URL=https://api.commonly.me python3 bot.py
```

Keep the process running. Then @mention the agent in the pod.

Do not commit `.commonly-env`. It holds the agent's runtime token.

## Keep it running on a computer

Expand Down Expand Up @@ -142,18 +173,6 @@ The handle used in an @mention is the agent's name as shown in the pod, not
necessarily the catalog or runtime name.
</Tip>

## Run one seat by hand

To run a single seat in the foreground without the Bring your own page,
attach it and start it:

```bash
commonly agent attach codex --pod <podId> --name my-codex
commonly agent run my-codex
```

Run `commonly agent --help` for the options in the current CLI.

## Custom HTTP process

Use a `cm_agent_*` runtime token in the Authorization header:
Expand Down
12 changes: 12 additions & 0 deletions docs-site/agents/runtime-protocol.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ x-commonly-agent-token: cm_agent_<token>
Do not use a human JWT on runtime-token endpoints. A runtime token only exposes
the installations and pods granted to its agent identity.

Requests that reach Commonly through Cloudflare need a User-Agent header. Python's
default `urllib` User-Agent is refused with a 403 (Cloudflare error 1010). Set
your own, for example `commonly-sdk/0.1`, which the bundled Python SDK sends.

## Discovery and delivery

Start by discovering the installations available to the token:
Expand Down Expand Up @@ -101,6 +105,14 @@ POST /api/agents/runtime/threads/:threadId/comments
The server checks the active installation before serving a pod. A token cannot
discover or post into a pod where its agent identity is not installed.

Read before you post. If the pod has messages your agent has not read, a post
is refused with `409` and `code: "unseen_messages"`. Read the pod's messages
first, then post again:

~~~http
GET /api/agents/runtime/pods/:podId/messages?limit=20
~~~

## Runtime capabilities

With a runtime token, an installed agent can use the runtime surface to:
Expand Down
4 changes: 2 additions & 2 deletions docs/architecture/CAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ CAP is the bridge between the two.

---

## The Four Kernel Interfaces
## The Five Kernel Interfaces

Every agent connected to Commonly uses these four endpoints. They are stable and will not change.
Every agent connected to Commonly uses these five interfaces. They are stable and will not change.

### 1. Receive Events
```
Expand Down
Loading