continuum-agent
Skill84 starsChanged 6 months agoApache-2.0View on GitHub
Build BaseAgent instances and run them with AgentRunner — covers fields, lifecycle hooks, structured outputs, ReAct mode, instruction modifiers, and the full execution flow. Invoke when the user asks "create an agent", "configure max_turns", "add lifecycle hooks", "structured output with Pydantic", or anything around the core agent abstraction.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/commands/monitoring/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/continuum.mdcCursor rule
- AgentDB Advanced FeaturesSkill
- AgentDB Learning PluginsSkill
- AgentDB Memory PatternsSkill
- AgentDB Performance OptimizationSkill
- AgentDB Vector SearchSkill
- browserSkill
- continuum-claude-codeSkill
- continuum-codexSkill
- continuum-cursorSkill
- continuum-evaluationSkill
- continuum-handoffsSkill
- continuum-llm-providersSkill
- continuum-memorySkill
- continuum-observabilitySkill
- continuum-quickstartSkill
- continuum-recipesSkill
- continuum-streamingSkill
- continuum-temporalSkill
- continuum-testingSkill
- continuum-tools-mcpSkill
- continuum-workflowsSkill
- github-code-reviewSkill
- github-multi-repoSkill
- github-project-managementSkill
- github-release-managementSkill
- github-workflow-automationSkill
- Hooks AutomationSkill
- Pair ProgrammingSkill
- ReasoningBank with AgentDBSkill
- ReasoningBank IntelligenceSkill
- Skill BuilderSkill
- sparc-methodologySkill
- stream-chainSkill
- swarm-advancedSkill
- Swarm OrchestrationSkill
- V3 CLI ModernizationSkill
- V3 Core ImplementationSkill
- V3 DDD ArchitectureSkill
- V3 Deep IntegrationSkill
- V3 MCP OptimizationSkill
- V3 Memory UnificationSkill
- V3 Performance OptimizationSkill
- V3 Security OverhaulSkill
- V3 Swarm CoordinationSkill
- Verification & Quality AssuranceSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 144
Don't pass role= / content= to SessionClient.add_message — pass a ChatMessage object.
- Very specific: line 146
Don't import MemoryScope from continuum.memory and then pass it to AgentMemoryConfig — that's the dataclass.
- Distinctive: line 149
Don't make hooks async — they're sync callables.
- Very specific: line 150
Don't change max_turns to a huge number.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill 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
Continuum Agent Skill
Authoritative source: docs/agent.md.
Core API
from continuum.agent import BaseAgent, AgentRunner
from continuum.agent.config import AgentConfig, AgentMemoryConfig, RunnerConfig
from continuum.agent.types import (
Handoff, MemoryScope, RunContext, AgentResponse, EventType,
)Minimal agent
agent = BaseAgent(
name="my-agent", # required, [A-Za-z0-9_-]+
instructions="...", # supports {slot} templates
model="gpt-4o-mini", # provider chosen by prefix
temperature=0.7,
max_tokens=None,
)
runner = AgentRunner()
resp = await runner.run(agent, "user input", user_id="u1", session_id="s1")
print(resp.content)
print(resp.usage.total_tokens)
print(resp.structured_output) # populated if output_schema setImportant BaseAgent parameters
| Parameter | Default | Notes |
name | required | unique id |
instructions | "" | supports {template_vars} |
model | settings.default_llm_model | prefix routes provider |
tools | [] | LLM-shaped dicts |
mcp_servers | [] | Auto-discovered tool sources |
handoffs | [] | [Handoff(target_agent=..., description=...)] |
memory_config | AgentMemoryConfig() | search_memories=True / store_memories=True |
output_schema | None | Pydantic model |
template_vars | {} | static slots |
examples | [] | few-shot |
instruction_modifiers | [] | dynamic prompt rewriters |
on_start / on_end / on_error / on_tool_call / on_handoff | None | sync callables |
config | AgentConfig() | max_turns=25, react_mode, reasoning_mode, scanners, strict_security, max_consecutive_handoffs=3 (same request to the same target before HandoffLoopError; fan-out over N items is never blocked), … |
gateway_mode | None | Smart Gateway routing: "strict" / "modest" / "quality" |
policy_store | None | Access-control store. None = fail-open (no authorization). Use PolicyStore.default_deny([...]) to fail closed; set AgentConfig(strict_security=True) to raise when side-effectful tools have no policy |
Structured output
from pydantic import BaseModel
class Plan(BaseModel):
intent: str
steps: list[str]
agent = BaseAgent(name="planner", instructions="...", output_schema=Plan)
resp = await runner.run(agent, "...")
plan: Plan = resp.structured_outputStreaming
from continuum.agent.types import EventType
async for ev in runner.run_stream(agent, "..."):
if ev.type == EventType.CONTENT_DELTA:
print(ev.data["content"], end="", flush=True)Memory scope (the agent enum, not the dataclass!)
from continuum.agent.types import MemoryScope
# MemoryScope.SHARED / USER / AGENT / RUN / CONVERSATION — string enumReAct + reasoning modes
agent = BaseAgent(
name="thinker",
instructions="...",
config=AgentConfig(react_mode=True, reasoning_mode=False),
)react_mode injects a hidden think tool the LLM must call before
producing a final answer. reasoning_mode does a silent "think first"
pass before the main loop.
RAG context
agent = BaseAgent(
name="rag-agent",
instructions="Answer using PROVIDED CONTEXT.",
config=AgentConfig(rag_context=retrieved_docs, require_context=True),
)Hooks
def on_tool_call(agent, tool_name, args):
print(f"{agent.name} -> {tool_name}({args})")
agent = BaseAgent(name="...", instructions="...", on_tool_call=on_tool_call)Hooks are sync. Async hooks are not awaited.
Execution flow (what runner.run() does)
- Validate input against
agent.input_schema(if any) - Build
RunContextandRunState; start trace - Load tool-context state from session
- Assemble messages: system prompt → ReAct scaffold → tool context → memory facts (Qdrant) → session history (Redis) → optional RAG → sanitized user input → optional context compression
- Optional reasoning pass (silent)
- Loop up to
max_turns: LLM call → run tools / handoffs → feed results back - Persist session, store memories, return
AgentResponse
Don't
- Don't pass
role=/content=toSessionClient.add_message— pass aChatMessageobject. - Don't import
MemoryScopefromcontinuum.memoryand then pass it toAgentMemoryConfig— that's the dataclass; the agent module re-exports the enum of the same name. - Don't make hooks async — they're sync callables.
- Don't change
max_turnsto a huge number; if a loop fails to converge in 25 turns the prompt is the problem.
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.

