SKILL.md
agent-contracts Tool Use / RAG
Use this skill when your nodes call external services (DB, search, HTTP APIs) or do retrieval-style work.
Core Ideas
- Declare dependencies in
NodeContract.services(andrequires_llmwhen needed). - Inject dependencies via:
- direct node construction (nodecls(llm=..., myservice=...)), or - dependencyprovider in buildgraphfromregistry(...).
- Keep LLM routing context small; rely on sanitization and
context_builderonly when needed.
Workflow
- Define service interfaces (thin wrappers) and keep them testable.
- Add
services=[...]toNodeContractand use those attributes inexecute(). - Validate services with
ContractValidator(known_services=..., strict=True)in CI. - For RAG:
- store small retrieval results in a domain slice (ids + snippets) - avoid storing full documents or large embeddings in state
- For routing accuracy:
- use rule triggers for obvious cases - use LLM only among a small candidate set
Guardrails
- Sanitize long strings and binary-like content before LLM routing (supervisor does this).
- Avoid leaking secrets into state; treat state as loggable.
References (load only when needed)
docs/core_concepts.md(Context Builder / Sanitization)docs/skills/official/agent-contracts-tool-use-rag/references/diandtesting.md