Skip to content

Add script agent type — deterministic code agents on the shared agent interface #235

@WiggidyW

Description

@WiggidyW

Summary

Introduce a new agent type, script, alongside the existing mock,
openrouter, claude-agent-sdk, and codex.

A script agent is deterministic code — not a real AI agent. It conforms to
the exact same agent interface as every other agent type, but instead of calling
an upstream model it executes code that operates on the input messages and the
MCP tools the agent is connected to, then returns an agent completion like any
other agent.

Philosophy: agents are the glue that connects software together

This cements a new ObjectiveAI philosophy: agents are the glue that connects
software together.
By sharing one common interface, a connection can be
deterministic code or a real AI agent — all behind the same interface. The
caller doesn't need to know or care which one it is.

When a script agent fails, it proceeds to fallbacks if fallbacks are configured
for that particular agent definition — exactly like regular agents. Deterministic
code and AI become interchangeable, composable links in the same chain.

This is the future of software.

Behavior

  • Executes user-supplied code that operates on the input messages and the MCP
    tools the agent has access to.
  • Deterministic.
  • Fallible: it can error out on unexpected cases.
  • On failure, the agent completions client automatically moves on to the
    configured fallback — falling through to a regular AI agent to handle the
    unexpected case, using the same fallback mechanism regular agents already use.

Interface

script is just another value in the agent-type set (mock / openrouter /
claude-agent-sdk / codex / script). Same content-addressed agent
definition, same completion shape, same fallback semantics — so a script agent
is a drop-in anywhere an agent is accepted (swarms, functions, fallback chains).

Open questions

  • Interpreter: a single fixed language (e.g. Starlark, which we already embed
    for the expression system) vs. a pluggable interpreter. This affects whether
    the type stays script (language-agnostic) or could be named after a concrete
    runtime.
  • Exact surface the code gets for reading messages and invoking MCP tools.
  • Error taxonomy: which failures trigger fallback vs. surface as hard errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions