agentic-flow-best-practices — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited agentic-flow-best-practices (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill is a compact thinking framework for agentic systems. It should help an agent choose the simplest reliable design, reason about the harness, and avoid wasting context.
Load references when they help the current decision:
references/resources.md: research launchpad with official docs, GitHub/source repos, and search hints for MCP, agent frameworks, context, memory, caching, and long-context risks.references/pr-review-agent-example.md: compact build-ready workflow example.references/agent-collaboration-patterns.md: compact guide to flows between agents, roles, handoffs, agents-as-tools, routing, review, and shared workspaces.When framework/protocol behavior matters, verify from official docs or source. Prefer project-local conventions first; use Octocode MCP tools when available. Carry evidence only when it changes the design.
Use this loop for substantial agentic-flow work:
Stop when the chosen pattern, contracts, gates, and verification plan are clear enough for the user's next decision. Ask one focused question only when a missing fact changes architecture, permissions, or side effects.
For any agentic flow, focus on the dimensions that affect the decision:
| Dimension | Question |
|---|---|
| Outcome | What user-visible job is done, and what is out of scope? |
| User experience | What should the user approve, see, interrupt, resume, or recover from? |
| Autonomy | Prompt, workflow, graph, tool-using agent, or multi-agent? |
| Runtime | Who owns the loop: code, protocol client, framework runtime, graph engine, or custom harness? |
| Tools/MCP | What tools/resources/prompts exist, who may call them, and what needs approval? |
| Identity | Which user, tenant, agent, service account, or policy grants each action? |
| Visible surface | What does each agent actually see: messages, instructions, MCP prompts/resources, tools, schemas, memory, retrieval, and examples? |
| Protocols | Which Zod schemas govern input, node output, tool result, handoff, memory, cache, gate, trace, and errors? |
| Context | What is static, retrieved, summarized, offloaded, isolated in subagents, or passed by artifact reference? |
| Memory | What is session state, checkpoint, agent-private, shared, user/project/org memory, artifact, or cache? |
| Data | What data can cross tenants, tools, models, logs, caches, memories, and artifacts? |
| Models | Which model class, reasoning effort, output budget, temperature, and fallback fit each node? |
| Safety | Where can the flow leak data, trust poisoned context, take irreversible action, or write bad memory? |
| Reliability | What retries, idempotency keys, timeouts, cancellation, and concurrency controls exist? |
| Observability | Can traces show route, schema version, model config, tool calls, cache decisions, errors, tokens, cost? |
| Evals | What golden, adversarial, schema, memory, and tool-failure tests prove behavior? |
| Rollout | How will versions, migrations, flags, canaries, and rollback work? |
Think first, then choose the smallest design that satisfies the outcome. The answer should feel like tradeoff reasoning, not a completed form.
Start simple; add autonomy only when it solves a real constraint.
plan -> act -> observe -> update -> stop.Framework fit is contextual, not a ranking: plain code for deterministic/small workflows; MCP for exposing tools/resources/prompts, not orchestration; SDKs or ADK-style runtimes when lifecycle, sessions, tools, tracing, and structured outputs are modeled; graph runtimes for durable state, persistence, human-in-loop, and long-running agents. Use names like OpenAI Agents SDK, Google ADK, LangChain, and LangGraph as examples to research, not required dependencies.
Check these areas when they affect the decision:
Describe the flow as nodes, not transcript history. For important nodes, capture:
purpose: why this node exists.inputSchema / outputSchema: Zod schemas or artifact contracts.tools: allowed tools and why.state: fields read/written and owner.cache: key, scope, freshness, invalidation, or none.memory: search/write/ignore plus consent and retention.failure: retry, ask, fallback, stop, or gate.sideEffects: files, APIs, messages, deploys, payments, memory writes.runControl: timeout, cancellation, resume, idempotency, and concurrency behavior.Common nodes: classify, retrieve, compute, reason, delegate, review, act, observe.
Agentic systems communicate through protocols. Agent-to-agent, node-to-node, agent-to-tool, cache, memory, gate, trace, and side-effect boundaries should have runtime-validated schemas. In TypeScript, use Zod as the source of truth; in other runtimes, use an equivalent schema library and keep JSON Schema interoperability.
Define the contracts that exist:
FlowInput, NodeInput, NodeOutputAgentTask, AgentResult, AgentHandoffToolCall, ToolResult, ErrorEnvelopeMemoryQuery, MemoryCandidate, MemoryWriteCacheEntry, HumanGate, TraceEventPolicyDecision, RunControl, ArtifactRefZod rules:
safeParse runtime boundaries before trusting data.unknown, not_found, not_allowed, redacted.Minimal packet shape: AgentTask should include goal, inputs, knownFacts, constraints, allowedTools, expectedOutput, and stopConditions. AgentResult should include status, output, evidence, unknowns, and memoryCandidates.
Attention is finite. Large context windows raise the ceiling but do not guarantee the model uses all tokens well; relevant facts buried in the middle can be missed. More context can lower signal-to-noise, duplicate facts, increase cost/latency, and create conflicting instructions.
Pass packets, not full history:
goal, inputs, knownFacts, decisions, openQuestions, constraints,
artifacts, expectedOutputBefore expanding context:
Token efficiency rules:
Review what each agent/model call actually receives, not only what the architecture diagram intends:
Check for duplicated or conflicting instructions across prompts, skills, MCP prompts, tool descriptions, schemas, memory, and retrieved docs. Keep one source of truth; place stable invariant instructions in the harness or stable prefix, and pass changing facts through compact task packets.
Separate memory, state, cache, and artifacts.
Memory rules:
MemoryCandidates.MCP exposes capabilities to AI apps:
tools: actions such as search, file/API/db calls, comments, deploys.resources: context data such as files, schemas, tickets, logs.prompts: reusable templates or interaction starters.Design tools like APIs: narrow names, clear docs, Zod/JSON schemas, example usage, error shapes, auth/retention notes, tool allowlists, and approval gates for destructive/costly/external actions.
Use skills for reusable procedural knowledge. Keep SKILL.md concise; move optional depth to references/scripts.
Use multiple agents when separation helps: expertise, tools, permissions, context windows, latency, review, or user-facing ownership. If specialists do not need separate tools/context, they may be prompt sections. For collaboration techniques, read references/agent-collaboration-patterns.md.
Handoff packet:
goal, inputs, knownFacts, constraints, allowedTools,
expectedOutput, stopConditionsCommon issues:
| Issue | Fix |
|---|---|
| vague ownership | one owner per state field/artifact |
| full-history handoff | handoff packet + artifact refs |
| supervisor bottleneck | workers decide locally inside bounds |
| tool bleed | per-agent tool allowlist |
| infinite delegation | max turns, budgets, terminal states |
| prose return | Zod-valid AgentResult |
| self-approval | separate reviewer/test/human gate |
| memory conflict | one memory writer or approval gate |
Node prompts should define role, node goal, inputs, tool permissions, decision criteria, output schema, failure behavior, and evidence rules. Leave thinking room for ambiguous architecture, memory scope, tool choice, or tradeoffs; use firm instructions at schema/tool/memory/cache/side-effect boundaries.
Model/config checks:
max_output_tokens: includes visible output and, for reasoning models, hidden reasoning.reasoning effort: more deliberation for harder decisions, more cost/latency.temperature: higher for ideation, lower for structured consistency.Cache small validated results keyed by normalized input, prompt/model/tool/data versions, scope, and freshness. Cache safety invariant: no secrets, raw private data without policy, tenant-crossing data, or hidden unkeyed state. Memory and cache solve different problems.
Prompt-cache safety:
Consider gates before destructive/costly/external side effects, durable memory writes, cross-tenant cache risk, new auth/billing/deploy ownership, conflicting evidence, or vague prompts that trigger action.
Verification by risk:
Use this as a flexible schema, not a required template. Select fields that help the user understand and build the flow.
Include the useful fields: Goal, Decision, Runtime, Roles, Protocols, Context, Memory, Tools/MCP, Lifecycle, Models, Flow, Run control, Rollout, and Verification.
reason node deciding and executing risky action.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.