agentsclimarketplace

Deterministic agent chain

Skill kjuhwa/skills-hub/skills/llm-agents/deterministic-agent-chain

Chain multiple agents sequentially in code, feeding each agent's output as the next agent's input.From its SKILL.md

Install
npx -y skills add kjuhwa/skills-hub --skill deterministic-agent-chain

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.6 KB, 425 tokens by cl100k_base, as published. Nobody here has run it

deterministic-agent-chain

Orchestrate a multi-step pipeline in code: each agent runs, produces output, and your code decides whether and how to invoke the next agent. More predictable than LLM-driven handoffs.

When to apply

Linear workflows where each step is clearly defined (generate → validate → refine). Use structured output from intermediate agents to branch logic in code.

Core snippet

import asyncio
from pydantic import BaseModel
from agents import Agent, Runner, trace

story_outline_agent = Agent(
    name="story_outline_agent",
    instructions="Generate a very short story outline based on the user's input.",
)

class OutlineCheckerOutput(BaseModel):
    good_quality: bool
    is_scifi: bool

outline_checker_agent = Agent(
    name="outline_checker_agent",
    instructions="Read the given story outline, judge quality and determine if it is scifi.",
    output_type=OutlineCheckerOutput,
)

story_agent = Agent(
    name="story_agent",
    instructions="Write a short story based on the given outline.",
    output_type=str,
)

async def main():
    with trace("Deterministic story flow"):
        outline_result = await Runner.run(story_outline_agent, "Write a short sci-fi story.")
        checker_result = await Runner.run(outline_checker_agent, outline_result.final_output)
        checker_output = checker_result.final_output_as(OutlineCheckerOutput)

        if not checker_output.good_quality or not checker_output.is_scifi:
            print("Outline didn't pass quality check, stopping.")
            return

        story_result = await Runner.run(story_agent, outline_result.final_output)
        print(story_result.final_output)

asyncio.run(main())

Key notes

  • Use result.final_output_as(Model) to get a typed intermediate result for branching
  • Each Runner.run() call is independent; pass outputs explicitly as strings or item lists
  • Wrap in trace() to view all steps in the OpenAI Traces dashboard as one workflow
  • More predictable cost/latency than fully autonomous multi-agent flows

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.