agora-workbench
AGENTS.md8 starsChanged 4 months agoMITView on GitHub
The project uses uv for dependency management with pyproject.toml at the repo root. Python ≥3.11 is required. Always run commands from the repo root. Use uv run to run any script (e.g. uv run python src/script.py) and uv add to add packages. The virtual environment is managed automatically — do not manually activate .venv. src/ is on the Python path. All imports use the agora_workbench namespace: Do not use bare package names — from code_execution import ... is wrong. BaseMCPServer…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 1 is common, 1 is distinctive, and 6 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Use uv run to run any script (e.g.
- Very specific: line 43
Do not use bare package names — from code_execution import ...
- Very specific: line 86
Follow the pattern in examples/servers/.
- Very specific: line 119
Before finishing work, ensure uv run ruff check .
- Very specific: line 138
Do not use bare package names — always import via agora_workbench.* (e.g., from agora_workbench.code_execution import ...).
- Very specific: line 139
Do not bypass uv or manually activate .venv.
- Common: line 140
Do not run live-marked tests unless explicitly requested and credentials are available.
- Distinctive: line 141
Do not add strict type annotations or fix pyright warnings that the config intentionally suppresses.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agora Workbench — Development Instructions
Environment & Commands
The project uses uv for dependency management with pyproject.toml at the repo root. Python ≥3.11 is required. Always run commands from the repo root.
uv sync # Install/update dependencies
uv run pytest -m "not live" # Run tests (excludes live/credential tests)
uv run ruff check --fix . # Lint (auto-fix)
uv run ruff format . # Format
uv run pyright --level error src # Type check (only src/ is checked in CI)Use uv run to run any script (e.g. uv run python src/script.py) and uv add to add packages. The virtual environment is managed automatically — do not manually activate .venv.
Repo Layout
src/
agora_workbench/
base/ # BaseMCPServer ABC — shared HTTP hosting, auth middleware
code_execution/ # CodeExecutionServer — kernel-backed code execution
connector/ # ConnectorServer — lightweight MCP proxy (router, gateway, dispatcher)
deployment/ # Deployment scaffold CLI and templates
activity_ui/ # Real-time activity monitoring UI
examples/
servers/ # Reference domain server implementations (chemistry, gis, energy)
agent_free_getting_started/ # Agent-free quickstart (raw MCP client usage)
docs/ # MkDocs documentation siteImport Conventions
src/ is on the Python path. All imports use the agora_workbench namespace:
from agora_workbench.base import BaseMCPServer
from agora_workbench.code_execution import CodeExecutionServer, ToolDefinition, ToolRegistry
from agora_workbench.connector import RouterServer, GatewayServerDo not use bare package names — from code_execution import ... is wrong.
Architecture
BaseMCPServer (in src/agora_workbench/base/) is the shared abstract base class. Two concrete server types inherit from it:
CodeExecutionServer— runs a Python kernel, executes user code, manages sessions and tool registries.ConnectorServer— stateless proxy that aggregates/routes/gates tool calls to upstream servers without its own kernel.
Both expose tools via FastMCP over Streamable HTTP with Bearer token auth middleware.
Sidecars (shared helper processes)
A CodeExecutionServer can declare sidecars in ServerConfig.sidecars (a list of SidecarConfig). A sidecar is a long-lived helper process the server launches at startup and stops on shutdown — used to load an expensive, process-global resource (typically a heavy model) once per container and share it across all isolated kernel sessions over loopback HTTP, instead of paying its memory cost inside every session.
Lifecycle is managed in src/agora_workbench/code_execution/server.py: _startup calls SidecarManager.start_all() (after the env is built, before kernels register), _shutdown calls stop_all(). warm() does not start sidecars (build-time only). The manager launches each process (with use_env_python=True, in the kernel env's Python so it shares the tools' deps), polls health_path until ready, and exports the base URL under url_env_var on os.environ so every spawned kernel inherits it — the same mechanism as MCP_ASSET_CACHE_DIR. A sidecar is a plain internal service, not an MCP endpoint and invisible to the agent (that's a ConnectorServer).
Key files:
src/agora_workbench/code_execution/code_execution_models.py—SidecarConfigmodel,ServerConfig.sidecarsfieldsrc/agora_workbench/code_execution/sidecar.py—SidecarManager(launch / health-check / stop)src/agora_workbench/code_execution/server.py—_startup/_shutdownwiring
See the sidecars guide for when and how to use one.
Unified State Graph (Router)
RouterServer supports a unified state graph for cross-server workflow discovery. It registers plan_{router_name}_workflow whenever upstreams have state-annotated tools. Optionally, bridges in RouterConfig inject cross-server edges:
- Aggregates state-annotated
ToolInfofrom all upstreams - Injects synthetic bridge edges (declared in config, not in upstream tools)
- Registers
plan_{router_name}_workflowfor cross-server path queries
Bridge edges live in RouterConfig.bridges as BridgeEdge objects (from_state, to_state, description). They are validated at startup against the aggregated catalog — both states must exist. The StateGraph.inject_bridges() method handles insertion.
Key files:
connector/models.py—BridgeEdgemodel,RouterConfig.bridgesfieldconnector/base.py—_setup_unified_state_graph()methodcode_execution/tools/search/state_graph.py—StateGraph.inject_bridges()
Adding Domain Tools
Follow the pattern in examples/servers/. A domain server:
- Subclasses
CodeExecutionServer - Defines tools as
ToolDefinitionobjects registered with aToolRegistry - Provides a
catalog.yamldescribing available tools, data assets, and libraries - Tool implementations live in packages installed into the execution kernel environment
Testing
Tests live in tests/ subdirectories alongside the code they test. Configured test paths:
src/agora_workbench/code_execution/tests/src/agora_workbench/connector/tests/examples/servers/tests/activity_ui/tests/
Markers: unit, integration, live, asyncio. Live tests are excluded by default (they require real credentials/network). pytest-asyncio runs in auto mode — async test functions are detected automatically.
uv run pytest -m "not live" # All non-live tests
uv run pytest src/agora_workbench/connector/tests/ -v # Target a specific packageLinting & Type Checking
- Ruff: line-length 120,
ruff check+ruff format. Pre-commit auto-fixes. - Pyright: basic mode,
--level error. The config is intentionally permissive — focus onreportUndefinedVariableandreportUnboundVariableerrors. Do not spend time on suppressed warning categories.
CI
- Linting (
linting.yaml): triggers on PRs changingsrc/**. Runsruff checkandpyright --level erroronsrc/. - Tests (
tests.yaml): triggers on PRs changingsrc/,activity_ui/,examples/. Runspytest -m "not live"across all test paths.
Before finishing work, ensure uv run ruff check . and uv run pytest -m "not live" pass for any changed areas.
Optional Extras & Dependency Groups
Extras (for optional feature dependencies):
uv sync --extra openai-agents # OpenAI Agents SDK adapter
uv sync --extra copilot-sdk # GitHub Copilot SDK adapter
uv sync --extra geo # Geospatial (rasterio, titiler)Dependency groups (for dev tooling):
uv sync --group dev # pytest, ruff, pre-commit, jupyter (default for development)
uv sync --group docs # mkdocs, mkdocs-material, mkdocstringsDo Not
- Do not use bare package names — always import via
agora_workbench.*(e.g.,from agora_workbench.code_execution import ...). - Do not bypass
uvor manually activate.venv. - Do not run live-marked tests unless explicitly requested and credentials are available.
- Do not add strict type annotations or fix pyright warnings that the config intentionally suppresses.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

