Keel Agent SDK
Keel is an agent-native research environment for Hyperliquid systematic
trading. The Python package provides one keel CLI and one stdio MCP command.
Both surfaces bind to the same outcome-tool registry.
This file is the package README and agent instruction entry point. Keep it short, current, and operational. Do not add command inventories unless they are checked against the outcome registry.
Choosing a Surface
The default surface is the hosted remote MCP. This package is the other way
to connect — the keel CLI and the local stdio MCP server (also shipped as the
Claude Desktop .mcpb bundle) — for terminals, scripts, CI, and file-based
workspaces. The hosted endpoint has no live-write tools at all; this package
loads them only on an explicit KEEL_TOOLSETS opt-in (see Live Trading
Safety). Running a strategy with real capital happens in the Keel web app.
- Hosted endpoint (default) —
https://mcp.usekeel.io/mcp: one endpoint, a 29-tool research/backtest/read surface, nothing to install. Paste the URL into Claude, ChatGPT or any remote-MCP client and sign in or sign up when prompted; Claude Code:claude mcp add --transport http keel https://mcp.usekeel.io/mcp; Codex:codex mcp add keel --url https://mcp.usekeel.io/mcp. The agent builds, tests and reads. When you want to run a strategy on your account, it hands it to the Keel app and you take it from there. Per-client steps: https://usekeel.io/agents
| You are… | Default path (shown first) | Also works |
|---|---|---|
| Using Claude/ChatGPT on web or phone | Hosted endpoint — paste the URL (directory one-click coming) | CLI + local MCP |
| Working in Claude Code / Cursor / terminal | Hosted endpoint — one command, or paste the URL | CLI + local MCP |
| Running a strategy from the Keel app | Keel web app (connect an account, review sizing, start it there) | reads on every surface |
| Trying a strategy forward without a connected exchange account | Paper run (simulated) — Keel web app, or keel paper on the CLI |
in-app chat, local MCP |
| Building your own agent/scripts | SDK + API key | CLI |
| Just browsing/running strategies | Web app + library | hosted endpoint |
Install
pipx install keel-trade
claude mcp add keel -- keel mcp serve
uv tool install keel-trade also works. Agent hosts launch the MCP command as
a stdio child process:
keel mcp serve
First Contact
When an agent starts with Keel:
- Call
keel_account_status. - If
authenticatedis false, callkeel_auth_login. - Read
workflow_routesfromkeel_account_statusbefore choosing lower-level tools. - For strategy creation or substantial edits, load the
strategy-creationprompt before composing source. - Search components with
keel_components_search. - Fetch exact component schemas with
keel_components_get_many. - Compose or validate DSL with
keel_strategy_compose. - Run evidence with
keel_backtest_run. - If the run is still active, watch it with
keel_backtest_watch. - Summarize evidence with
keel_backtest_summarize. - Share only when the user explicitly asks, via
keel_share_create.
Do not invent Keel commands. If unsure, call keel_help, inspect tools/list,
or run keel --help.
Authentication
Preferred agent path:
keel_account_status -> keel_auth_login -> retry original tool
keel_auth_login opens the OAuth browser flow, captures the loopback redirect,
and stores credentials in ~/.keel/config.yaml. The CLI uses the same state:
keel auth login
Headless environments can use:
keel auth login --key <token>
Live-trading consent is requested explicitly:
keel_auth_login(scope="live")
or:
keel auth login --scope live
Recommended Strategy Workflow
Use prompts for workflow, resources for context, tools for actions, and URLs for human handoff.
strategy-creation prompt
keel_components_search(keyword="momentum")
keel_components_get_many(names=["ROC", "ForecastScaler", "..."])
keel_strategy_compose(source_file="strategy.py", dry_run=true)
keel_strategy_compose(source_file="strategy.py", name="momentum-baseline")
keel_backtest_run(strategy_id="str_...", start_date="2025-01-01")
keel_backtest_watch(backtest_id="bt_...")
keel_backtest_summarize(backtest_id="bt_...")
CLI equivalents:
keel components search momentum --format json
keel components describe-batch ROC ForecastScaler --format json
keel strategy compose --source-file strategy.py --dry-run --format json
keel strategy compose --source-file strategy.py --name momentum-baseline --format json
keel backtest run str_abc123 --start-date 2025-01-01 --format json
keel backtest watch bt_abc123 --format json
keel backtest summarize bt_abc123 --format json
For checked-out local strategy work:
keel project init
keel strategy checkout str_abc123
keel strategy status str_abc123
keel strategy push str_abc123 -m "describe the change"
keel backtest run str_abc123 --auto-push --start-date 2025-01-01
keel strategy log str_abc123
keel strategy restore str_abc123 --ref 3
Backtests run server-side strategy versions. Local edits that are ahead are
pushed automatically before the run (write-through default; pass
auto_push=false / --no-auto-push to opt out).
end_date / --end-date is optional and defaults to today's UTC date.
State Model & Sync (read this once)
Server HEAD is the single source of truth for strategy source. Every
runnable action — backtest, deploy, share — resolves against a server
commit, never a local file. The local workspace (keel_strategy_checkout)
is a working copy: convenient, disposable, always reconcilable.
- Write-through by default.
keel_backtest_runand thekeel_live_deploypreview push unpushed local edits automatically (generated commit message, or passpush_message) and pin to the pushed commit, so you always run what you actually have. Opt out withauto_push=false— then a locally-ahead strategy raiseslocal_aheadinstead of silently testing old server code. - Pull-through on server-side edits.
keel_strategy_composeupdates a same-machine checkout in the same operation (workspace_syncin the response). Edits made elsewhere (web editor, another machine, hosted MCP) are detected by hash on the next local tool touch;keel_strategy_statusthen says exactly one thing to do (keel_strategy_pull). - Conflicts never resolve silently. A true conflict (local edited AND
server moved) stops any push/pull/backtest/deploy with a
sync_conflictenvelope carrying three-way context (base_hash,local_hash,server_hash,server_last_modified,server_modified_via) and exactly three recovery options:pull_force(take server, lose local), manual merge viakeel_strategy_diff, or pinning an explicitcommit_idon the blocked action. There is no auto-merge and no force-push recommendation, ever. - Commits carry surface attribution.
keel_strategy_historyshowsmodified_viaper commit ("modified via claude.ai, 2h ago") so multi-surface work stays legible. - Remote/hosted MCP is file-free: no workspace tools, inline
sourceonly; web and chat write the server directly.
Current MCP Tools
MCP tools are callable by canonical keel_* names. KEEL_TOOLSETS filters the
MCP surface only; the CLI command tree is generated independently.
For the exact generated schema/annotation/CLI mapping, see
packages/keel-trade/docs/tool-reference.md.
Always loaded:
keel_auth_loginkeel_auth_logoutkeel_connection_checkkeel_feedbackkeel_helpkeel_account_status
Read-only:
keel_accounts_listkeel_audit_list_lastkeel_components_searchkeel_components_get(single known component schema/detail)keel_components_get_many(several component schemas before composing)keel_library_listkeel_library_getkeel_app_linkkeel_strategy_readinesskeel_plan_usagekeel_strategy_getkeel_strategy_searchkeel_strategy_diffkeel_strategy_historykeel_strategy_notes_readkeel_strategy_workspaces
Research and backtest:
keel_strategy_composekeel_strategy_checkoutkeel_strategy_deletekeel_strategy_discardkeel_strategy_forkkeel_strategy_notes_addkeel_strategy_pullkeel_strategy_pushkeel_strategy_restorekeel_strategy_statuskeel_library_forkkeel_backtest_runkeel_backtest_watchkeel_backtest_summarizekeel_backtest_comparekeel_backtest_positions(one run's positions, each entry to exit: a summary by default, one page perasset/start–endscope; CLIkeel backtest positions, aliaskeel backtest trades)
Sharing:
keel_share_create
Live read, loaded by default:
keel_live_monitor(12 views;view='executions'takesexpand_ordersandexecution_run_id)keel_deployments_listkeel_live_receipt(one EPISODE's sealed receipt — a multi-episode run has one per episode and no single run-level receipt)keel_live_qualitykeel_accounts_safety(execution HALT state; operator-gated, and its refusal is not an auth problem)
Live write, loaded only when KEEL_TOOLSETS includes live-write:
keel_live_deploykeel_live_controlkeel_live_update
Default MCP toolsets are always,read-only,backtest,share,live-read. Opt into
live write tools only when the user is explicitly working on live deployment or
control:
export KEEL_TOOLSETS=read-only,backtest,share,live-read,live-write
KEEL_TOOLSETS=live remains a deprecated compatibility alias for
live-read,live-write; new configs should use the explicit split.
MCP Prompts
These prompts are bundled as MCP prompts under the keel-skill tag and are also
used as workflow guidance in other Keel agent contexts:
strategy-creationstrategy-fork-and-iteratebacktest-and-analyzeoverfit-checkdeploy-and-monitorportfolio-reviewcomponent-discoveryrecover-from-error
Use strategy-creation before a first keel_strategy_compose call in a session.
Use backtest-and-analyze before interpreting backtest results. Use
recover-from-error when a tool repeatedly fails.
MCP Resources
Use resources for read-only context that should not be recomputed through tool calls:
keel://components/catalogkeel://components/{name}/schemakeel://strategy/{strategy_id}/sourcekeel://strategy/{strategy_id}/lockfilekeel://backtest/{backtest_id}/resultskeel://backtest/latestkeel://strategy/{strategy_id}/backtest/latestkeel://dsl/reference/{topic}keel://knowledge/{section}keel://context/strategy/{strategy_id}
Local server only (stdio MCP / .mcpb; not on the hosted endpoint, where the
server's filesystem is not yours):
keel://context/user—~/.keel/context.mdkeel://context/project—keel.mdor the## Keelblock ofCLAUDE.mdin the server's working directory
Live Trading Safety
Live trading is opt-in and should be treated as a release gate, not a normal research action. Going live is a human action in the Keel web app.
Required posture:
- Do not deploy unless the user explicitly asks.
- Load
deploy-and-monitor. - Call
keel_live_deploy(strategy_id=...). It places no orders and picks no account: it returnscode=handoff_requiredwith anaction_urlinto the web deploy flow, where the human selects or connects the account, reviews the server-computed sizing, accepts the risk, and goes live. Relay theaction_urlin prose; do not try to deploy in the terminal. - To check on the handoff, call it again with
intent_token(the handoff'sresume.token) andpreview=true: a pure status poll returningpending,completed(with thedeployment_id) orexpired. - Monitor immediately with
keel_live_monitor.
keel_live_monitor returns a freshness block. Read it before summarizing
live data: view="positions" is an on-demand Hyperliquid snapshot, while
portfolio/history views come from Keel backend records and can lag the live
dashboard stream.
CLI arming is local-machine authorization:
keel arm live set --account acct_...
Local arming is not a sizing or risk cap. It means this machine is allowed to perform live actions for that account until expiry.
keel_live_control (pause, resume, stop, trigger) requires local arming. The
preview=true -> confirmation_token -> preview=false sequence belongs only
to the direct=true operator escape hatch, which is inert unless the operator
sets KEEL_ALLOW_DIRECT_DEPLOY and is refused on any hosted surface; that path
also needs live OAuth scope and local arming. It is not the way to go live.
CLI Contract
All outcome commands support:
--format json|table|tsv|human
Agents should prefer --format json. Human progress should not be parsed from
stdout; parse stable JSON fields such as hero_url, resource_uri,
share_url, summary_metrics, backtest_id, and strategy_id.
Agent mode is enabled by KEEL_AGENT_MODE=true, common agent environment
variables, or non-TTY stdout. KEEL_AGENT_MODE=false forces human defaults and
is the script/CI opt-out.
Destructive CLI commands require --yes in agent mode. Agents should add it
only after the user has confirmed the action. If omitted, the CLI returns a
structured cli_confirmation_required error explaining what to ask the user.
Current CLI Shape
Outcome-backed CLI commands use the same nouns as MCP tools:
keel status
keel doctor
keel help <topic>
keel components search <keyword>
keel components compose-help <name>
keel components describe-batch <name1> <name2>
keel strategy search
keel strategy get <strategy_id>
keel strategy compose
keel strategy checkout <strategy_id>
keel strategy status <strategy_id>
keel strategy push <strategy_id> -m "message"
keel strategy pull <strategy_id>
keel strategy log <strategy_id>
keel strategy restore <strategy_id> --ref <ref>
keel backtest run <strategy_id> --start-date YYYY-MM-DD [--end-date YYYY-MM-DD]
keel backtest watch <backtest_id>
keel backtest summarize <backtest_id>
keel share create <target_id> --yes
keel accounts list
keel live deploy <strategy_id>
keel live deploy <strategy_id> --intent-token <token>
keel live monitor <deployment_id>
keel live control <deployment_id> --action pause|resume|stop|trigger --yes
keel audit list-last
CLI-only operational commands include:
keel auth login
keel auth status
keel auth whoami
keel auth logout
keel mcp serve
keel project init
keel context show --layer user|project
keel arm live set --account <account_id>
keel arm status
keel arm disarm
What Not To Do
- Do not use the removed meta-tool pattern from older docs. Current MCP tools
are direct
keel_*tools. - Do not use old commands that are absent from
keel --helpand the current CLI shape above. - Do not claim backtest results without a
keel_backtest_runresult orkeel_backtest_summarizeevidence. - Do not create public share links unless the user asks.
- Do not live deploy, pause, resume, stop, or trigger without explicit user confirmation.
Metadata
Release files for keel-trade 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| keel_trade-0.9.0.tar.gz | 2.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| keel_trade-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.1 MB
Release files / keel_trade-0.9.0.tar.gz
| Download URL | keel_trade-0.9.0.tar.gz |
|---|---|
| Size | 2.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc66ccf7d47d0bd594a225497ca8ed8eb022ea6670b5508b24491428d27dfe8f
|
|
BLAKE2b-256 checksum How to use checksums |
3fc650fa23c2ce7c91f5b2b7aa9cdcdd1f1dc870d5218d1bea48b9323f4bb1dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / keel_trade-0.9.0-py3-none-any.whl
| Download URL | keel_trade-0.9.0-py3-none-any.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e85e25d23dc033c987cacf8c70d6568fbc0187cf055d25d56fc84940abb947b6
|
|
BLAKE2b-256 checksum How to use checksums |
511f091b12cb19b944109716379c804ab3d2ab1d401e6ef2212513c4d1543acc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency log