recipe

command
v3.1.0-dev.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

examples/embed/recipe — One-Call Recipe Embedder (agent.RunRecipe)

This example demonstrates running a complete core-agent recipe directory in a single function call via agent.RunRecipe (or agent.RunOneShot / agent.RunWorkload) without manually wiring config.Load, models.Resolve, permissions.FromConfig, tools.GateTools, agent.NewSubagentTool, usage.TurnTap, and agent.New.

For callers that want .agents/AGENTS.d/*.md overlays and @include expansion via pkg/instruction, pkg/compose exposes the identical signature as compose.Run, compose.RunRecipe, and compose.RunWorkload.

What agent.RunRecipe wires automatically

  1. Recipe discovery (Dir) — loads .agents/config.json, Markdown-authored subagents under .agents/subagents/*.md, and AGENTS.md.
  2. Permission gate (pkg/permissions) — builds a permissions.Gate from the recipe's permissions block and wraps caller-supplied Tools and Toolsets through tools.GateTools / tools.GateToolset.
  3. Declarative subagents — constructs declared subagents with their configured mode (chat, task, or single_turn), output_schema, tier, tools, and budgets.
  4. Usage & structured output — tracks main-turn and subagent token/cost totals in OneShotResult.Usage and parses structured JSON object responses into OneShotResult.Output.

Running

The example uses an offline scripted llm.LLM and requires no credentials or network access:

go run ./examples/embed/recipe

Slim dependency guarantee

Like examples/embed/slim, ./examples/embed/recipe is checked by dev/tools/verify-slim-deps to ensure the one-call pkg/agent facade stays within the slim-embed dependency boundary.

Documentation

Overview

Command recipe is the reference one-call recipe embedder for core-agent (#1404).

Compared to examples/embed/slim (which wires models.Adapt, permissions.Gate, tools.GateToolset, usage.TurnTap, and agent.New step by step), this example uses agent.RunRecipe to load a recipe directory (.agents/config.json, .agents/subagents/*.md, and AGENTS.md), gate custom tools, execute a single-turn structured subagent alongside a custom tool, and return a typed OneShotResult in a single call — while remaining inside the slim dependency boundary enforced by dev/tools/verify-slim-deps.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL