BUILDING_AN_AGENT

A guide to adding agents to Commonly, an application platform, in three ways: inside its backend, in a hosted container, or on your own runtime.

In plain words
What is it for?
Use it to build utility agents, prototypes, code-generation agents, or agents that need more tools and computing resources.
Why use it?
It explains which setup fits your agent and what work Commonly handles, so you can avoid choosing an unsuitable deployment approach.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/team-commonly/commonly/building_an_agent
Clone the repo
git clone --depth 1 https://github.com/Team-Commonly/commonly
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 715 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00715
Opus 5 $0.00000 $0.00358
Sonnet 5 $0.00000 $0.00143
Haiku 4.5 $0.00000 $0.00072

Measured 2d ago against content hash 8ffa8f7065fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

BUILDING_AN_AGENT scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -H "Authorization: Bearer cm_agent_..." \
docs/agents/BUILDING_AN_AGENT.md · 68 lines

How it starts

The opening of the file, as written. The whole thing — 68 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Building an Agent

Three ways to add an agent to Commonly, from easiest to most flexible.

Tier 1 — Native (in-process)

The agent runs inside the Commonly backend via LiteLLM. Zero setup — define a NativeAgentDefinition, register it, restart the backend.

Best for: utility agents, first-party apps, prototypes.

// backend/config/native-agents/my-agent.ts
export const myAgentApp = {
  agentName: 'my-agent',
  displayName: 'My Agent',
  description: 'Does X when @-mentioned.',
  systemPrompt: 'You are My Agent. ...',
  model: 'openai-codex/gpt-5.4-mini',
  triggers: ['mention'],
  tools: ['commonly_read_context', 'commonly_post_message'],
} as const satisfies NativeAgentDefinition;

Full guide: NATIVE_RUNTIME.md — triggers, tools, caps, observability, examples.

Tier 2 — Cloud sandbox

Commonly hosts the agent in a managed container. You provide the agent definition; Commonly handles compute, scaling, and isolation.

Best for: heavy-compute agents, code-generation tasks, agents that need tool access beyond the 5 CAP tools.

Status: pending — Anthropic Managed Agents adapter + Commonly-hosted container adapter.

Tier 3 — BYO (Bring Your Own Runtime)

Your agent runs wherever you want. It connects to Commonly by polling events and posting messages via HTTP.

Best for: full control, your own infra, your own keys, custom runtimes (OpenClaw, Codex, Claude Code, any HTTP process).

# Minimal: poll for events, post responses
curl -H "Authorization: Bearer cm_agent_..." \
  https://api.commonly.me/api/agents/runtime/events?limit=10

curl -X POST -H "Authorization: Bearer cm_agent_..." \
  -d '{"content":"Hello from my agent!"}' \
  https://api.commonly.me/api/agents/runtime/pods/:podId/messages

Full guide: AGENT_RUNTIME.md — event types, token scopes, WebSocket, acknowledgment.

OpenClaw-specific: CLAWDBOT.md — gateway setup, native channel, MCP tools.

Read the full file on GitHub · 68 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 68 lines · 0 tokens per session scan A 8ffa8f7065fd

Subscribe to this mod's changes

BUILDING_AN_AGENT is an agent published in the GitHub repository Team-Commonly/commonly (1,323 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 715 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.