agentleFS
laguagulaguagu/claude-code-nextjs-skills/skills/ai-sdk-7/references/agents.md

claude-code-nextjs-skills / references

AGENTS.md67 starsChanged 2 months agoMITView on GitHub

Build ToolLoopAgent and WorkflowAgent agents with AI SDK 7.

The file

We split this agents.md into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 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.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read installed workflow types before adapting core agent helpers.

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
agents.md

Agent execution contracts

Choose ToolLoopAgent for an in-memory request lifecycle, WorkflowAgent from @ai-sdk/workflow for durable workflow-backed execution, and HarnessAgent for a runtime such as Claude Code or Codex. Text functions default to one step, ToolLoopAgent to 20; WorkflowAgent has no default step-count limit. Set stopWhen for the task budget.

ToolLoopAgent accepts generation/streaming calls and infers UI message types with InferAgentUIMessage. Request state belongs in per-call options or prepareCall, not a mutable singleton shared across tenants.

runtimeContext is shared loop state; toolsContext is validated per-tool state through contextSchema. Put information the model needs in instructions or messages, not only context.

WorkflowAgent is stream-first (generate() throws), writes ModelCallStreamPart chunks to a workflow writable and converts them at the UI boundary with createModelCallToUIChunkTransform(). Durable tool work uses 'use step'; context must be serializable. Its approval API remains tool-level needsApproval, while ToolLoopAgent uses toolApproval. UI types come from InferWorkflowAgentUIMessage. It replaces Workflow DevKit's DurableAgent. The package peer-requires workflow 5 (^5.0.0-beta; the bundled guide installs workflow@beta), not 4.x. Signed approvals use experimental_toolApprovalSecret: { environmentVariable } so raw keys are not serialized into durable steps.

Read installed workflow types before adapting core agent helpers. Start from agent docs and WorkflowAgent docs; for runtime-owned history see harnesses.md.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.