Add Claude Managed Agents and Cursor SDK providers for trading agents - #145
Open
anthonyrs06 wants to merge 2 commits into
Open
Add Claude Managed Agents and Cursor SDK providers for trading agents#145anthonyrs06 wants to merge 2 commits into
anthonyrs06 wants to merge 2 commits into
Conversation
…essions New agent_key provider that runs the trading brain on Anthropic's hosted Managed Agents harness: persistent conversation per session, cross-session memory store, and local tool execution via an MCP-to-custom-tool bridge gated by the existing risk permission callback. Wedged hosted sessions are rotated automatically after consecutive tick timeouts. Co-authored-by: Cursor <cursoragent@cursor.com>
Runs the trading brain on the Cursor SDK local runtime with a persistent conversation per Condor session and filesystem memory under the agent directory. Recovers automatically from wedged bridges and remote agents: send() retries once after resetting the bridge and rotating the persisted agent on InternalServerError/ConnectError, the engine rotates after consecutive provider errors, and starting a second cursor-managed session for the same agent returns 409. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
TickEnginecurrently supports two LLM provider families viaagent_key: ACP subprocess agents (claude-code,gemini, ...) that rebuild the full prompt each tick, and PydanticAI direct-API models. Neither offers a persistent conversation — every tick starts from a cold context, so the agent has no native memory of earlier ticks beyond what the journal re-injects.Change
Two new opt-in providers with persistent sessions and local tool execution:
claude-managed[:<model>]— runs the brain on Anthropic's hosted Managed Agents harness:build_managed_tick_prompt)/mnt/memoryin the agent sandbox — the self-learning loop survives restartsMcpToolBridge(condor/acp/managed_tools.py): the hosted agent emits tool requests, Condor executes them locally through the same MCP servers, gated by the existingauto_approve_with_risk_checkcallback. Credentials never leave the machine; dry-run/risk blocking behaves identically to other providerscursor-managed[:<model>]— runs the brain on the Cursor SDK local runtime:memory/playbooks.md,mistakes.md,regimes.md)send()retries once after resetting the SDK bridge and rotating the persisted agent onInternalServerError/ConnectError; the engine rotates after 2 consecutive provider errors; new sessions always provision a fresh remote conversation; starting a second cursor-managed session for the same agent returns 409Risks
agent_key; existing ACP/PydanticAI paths are untouched apart from a shared prompt-branch conditionanthropic>=0.109.1,cursor-sdk>=0.1.8) are import-guarded inside the provider modulesRollout
condor/trading_agent/README.mdANTHROPIC_API_KEY(claude-managed) /CURSOR_API_KEY(cursor-managed)Test plan
pytest tests/— 29 passed (managed tool bridge, session rotation, cursor client event mapping, permission blocking, bridge recovery, engine routing)import condor.trading_agent.engine/condor.web.routes.agentscleanMade with Cursor