Agentflow
Build agents with 10xscale-agentflow - Agent class, StateGraph, ToolNode, streaming, checkpointingFrom its SKILL.md
npx -y skills add Mothilal-M/agentflow-skills --skill agentflowAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.8 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
When to use
Load this skill whenever the user is building an agent with 10xscale-agentflow (the agentflow Python package). It teaches the 10-30 line patterns that handle ~90% of use cases. For prebuilt workflows (RAG, Router) see the prebuilt-patterns skill. For tool adapters (MCP, LangChain, Composio) see tool-integrations. For deployment see production.
Installation
pip install 10xscale-agentflow
# optional extras:
pip install 10xscale-agentflow[pg_checkpoint,mcp,langchain,composio]
Set an LLM key:
export OPENAI_API_KEY=sk-... # or GEMINI_API_KEY / ANTHROPIC_API_KEY
.env files are auto-loaded.
Canonical imports
The most common mistake from older snippets is using agentflow.graph / agentflow.state / agentflow.checkpointer — those paths do not exist. Always use:
from agentflow.core.graph import Agent, StateGraph, ToolNode
from agentflow.core.state import AgentState, Message
from agentflow.utils.constants import END
from agentflow.storage.checkpointer import InMemoryCheckpointer
For the full list see ./reference/imports.md.
Minimal tool-calling agent
from agentflow.core.graph import Agent, StateGraph, ToolNode
from agentflow.core.state import AgentState, Message
from agentflow.utils.constants import END
def get_weather(location: str) -> str:
"""Get weather for a location."""
return f"The weather in {location} is sunny, 72°F"
tool_node = ToolNode(tools=[get_weather])
graph = StateGraph()
graph.add_node("MAIN", Agent(
model="gemini/gemini-2.5-flash",
system_prompt=[{"role": "system", "content": "You are a helpful assistant."}],
tool_node=tool_node,
))
graph.add_node("TOOL", tool_node)
def route(state: AgentState) -> str:
if state.context and state.context[-1].tools_calls: # note: tools_calls (plural)
return "TOOL"
return END
graph.add_conditional_edges("MAIN", route, {"TOOL": "TOOL", END: END})
graph.add_edge("TOOL", "MAIN")
graph.set_entry_point("MAIN")
app = graph.compile()
result = app.invoke(
{"messages": [Message.text_message("What's the weather in NYC?")]},
config={"thread_id": "1"},
)
for msg in result["messages"]:
print(f"{msg.role}: {msg.content}")
That's the full template. From here, look up the focused references below for whichever piece the user wants to extend.
Reference index
Load the targeted file when working on a specific topic:
- ./reference/imports.md — Canonical Python import paths and the gotchas the README gets wrong.
- ./reference/graph.md —
StateGraphAPI:add_node,add_edge,add_conditional_edges,set_entry_point,compile, recursion limits, common topologies. - ./reference/agent-class.md —
Agent(...)constructor:model,tool_node,output_type, fallback models, retry config, structured output, tag-gated tools. - ./reference/tools.md —
ToolNode: local Python tools, MCP, LangChain, Composio, dependency injection (tool_call_id,state,config), parallel execution. - ./reference/state.md —
AgentStatefields, theMessageclass (text_message,tool_message,image_message, multimodal blocks), and routing onstate.context. - ./reference/streaming.md —
invokevsastream, event types (LLM_DELTA,NODE_END, …), SSE / WebSocket forwarding, cancellation. - ./reference/checkpointing.md —
InMemoryCheckpointerfor demos,PgCheckpointerfor production,thread_idsemantics, custom checkpointers. - ./reference/models.md — LiteLLM model-string format, provider mapping, env vars, fallback chains, picking a model.
Common mistakes to avoid
tools_callsnottool_calls. The attribute on aMessageis plural.Message.from_text(...)doesn't exist. UseMessage.text_message(...).- Tool functions need type hints + a docstring. That's how the JSON schema is generated.
thread_idis required in theconfigdict for anyinvoke/astreamcall.InMemoryCheckpointeris demo-only — usePgCheckpointerfor anything serving multiple workers.- Wrong import paths — see ./reference/imports.md.
Sibling skills
prebuilt-patterns—ReactAgent,RAGAgent,RouterAgentfor ready-made topologies.tool-integrations— MCP, LangChain, Composio recipes.production—agentflow init/api/build, FastAPI deploy, observability, human-in-the-loop.
What ships with it: 8 files
29.1 KB alongside SKILL.md
reference/
- agent-class.md4.3 KB
- checkpointing.md3.7 KB
- graph.md3.9 KB
- imports.md2.2 KB
- models.md3.3 KB
- state.md3.9 KB
- streaming.md3.5 KB
- tools.md4.4 KB