add-agent-node
Add a new node (agent role) to the multi-agent SimpleGraph in agentic-platform, with routing and tests.
- License 许可
- MIT
- 最近更新
- 2026-09-21
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- add-agent-node
- description
- Add a new node (agent role) to the multi-agent SimpleGraph in agentic-platform, with routing and tests.
03 SKILL.md 正文
Add a new agent node to the graph
Use this when asked to add a new step/role to the multi-agent pipeline (e.g. a "fact-checker" node, a "summarizer" node, a "translator" node).
Steps
-
Add the role to
AgentRoleinsrc/agentic_platform/agents/state.pyif the new node represents a distinct conceptual role (not just a helper function). -
Write the node function in
src/agentic_platform/agents/graph.pyinsidebuild_research_writer_graph(or a newbuild_*_graphfactory if this is a genuinely different pipeline shape). A node function has the signature(state: AgentState) -> AgentState— it must be pure with respect to everything exceptstate(no hidden global mutation), and should callstate.add(role, content)to log what it did. -
Wire it into
nodesandroutersin the returnedSimpleGraph. Routers are(state: AgentState) -> strfunctions returning the next node's key orEND. Keep routing logic explicit and testable — avoid deeply nested conditionals in a router; extract a helper function if the condition is non-trivial. -
Respect
max_steps. The graph raisesGraphExecutionErrorifmax_stepsis exceeded — this is a deliberate safety rail against infinite agent loops. Don't raisemax_stepscasually; if a legitimate workflow needs more steps, that's a signal to reconsider the graph shape. -
Write tests (see skill
write-tests-100-coverage):- A unit test if the node has meaningful logic in isolation.
- An integration test in
tests/integration/test_graph.pyexercising the new node as part of a full graph run. - Cover both the "happy path" and any error/edge branch your node introduces (e.g. what happens when its dependency returns nothing).
-
Run
make cibefore considering the task done. 100% coverage is enforced — a new node with an untested branch will fail the build.
Anti-patterns to avoid
- Don't call
llm.complete()or any tool directly from a router function — routers should only inspectstate, not perform side effects. - Don't introduce a new sensitive tool call without registering it with
sensitive=Truein theToolRegistryand confirming the human-in-the-loop path is tested (seeHumanApprovalRequiredError).
04 同仓库更多 Skills
write-tests-100-coverage
Write tests that keep agentic-platform at 100% branch coverage without gaming the metric.
add-rag-source
Add a new document source into the HybridRetriever knowledge base in agentic-platform.
add-fastapi-endpoint
Add a new endpoint to the agentic-platform FastAPI service in src/agentic_platform/api/main.py.
add-agent-node
Add a new node (agent role) to the multi-agent SimpleGraph in agentic-platform, with routing and tests.
write-tests-100-coverage
Write tests that keep agentic-platform at 100% branch coverage without gaming the metric.
add-rag-source
Add a new document source into the HybridRetriever knowledge base in agentic-platform.