Skip to main content
This guide is for developers building AI agents that create trading strategies in Traseq. You’ll learn how to go from generating a strategy payload to running a backtest — all through the Public Agent API.

Choosing a payload format

Your agent can submit strategies in two formats:
  • SignalGraph — recommended for AI agents. It’s higher-level, easier to generate, and simpler to repair when validation fails.
  • StrategyAst — the canonical format. Use this if your agent already produces it directly.

Minimum scopes

For an autonomous agent that validates, writes strategies, and runs backtests, the recommended minimum scopes are:
  • workspace_read
  • strategies_write
  • backtests_write
  • backtests_read
Recommended add-ons:
  • strategies_read Useful if your agent needs to inspect existing strategies and versions.
  • system_strategies_read Useful if your agent starts from built-in templates.
  1. GET /public/v1 Read the manifest and discover the workflow contract.
  2. GET /public/v1/workspace Inspect workspace identity, API key scopes, and subscription tier.
  3. GET /public/v1/capabilities Fetch machine-readable indicators, node inputs, bindings, operators, tier limits, and validation issue shape before authoring a payload.
  4. POST /public/v1/strategies/validate Validate the draft payload and repair it until valid === true.
  5. POST /public/v1/strategies Create a draft strategy.
  6. POST /public/v1/strategies/:id/versions/finalize Promote a version to ready.
  7. POST /public/v1/backtests Queue a backtest.
  8. GET /public/v1/backtests/:id Poll until the backtest reaches a terminal state.

Discovering capabilities

Always call GET /public/v1/capabilities before your agent writes a strategy. This endpoint returns everything your agent needs to know about what’s supported:
  • available indicators and their parameters
  • supported node kinds and bindings for SignalGraph
  • operators, enums (timeframes, market fields, patterns)
  • plan-specific limits
  • the validation issue format (code, path, message, suggestion)
Use this as your source of truth — don’t guess indicator names or parameter shapes from prompts alone.

Structured validation issues

POST /public/v1/strategies/validate returns machine-readable issues. Token, AST, and graph validation issues now include:
  • code
  • path
  • message
  • suggestion
Example token issue:
Recommended repair loop:
  1. Generate signalGraph or strategyAst.
  2. Validate.
  3. Group issues by severity.
  4. Repair the payload using code, path, and suggestion.
  5. Revalidate until blocking issues are gone.

cURL example

Ready-to-use assets

Two reference files are available to help you get started:
  • traseq-agent-tool-schema.json — a tool contract for the public API, ready to use with tool-enabled AI agents.
  • traseq-agent-example.ts — a minimal TypeScript client with a validate-repair loop helper.

TypeScript SDK example

Here’s the core pattern for building an agent client. See traseq-agent-example.ts for a full working version.
The key point is the strict ordering — always follow this sequence:
  1. read workspace and capabilities
  2. generate signalGraph
  3. validate
  4. repair
  5. create
  6. finalize
  7. backtest

Agent tool schema

Instead of giving your AI model raw HTTP access, wrap the API in a structured tool layer. See traseq-agent-tool-schema.json for the full JSON definition. Recommended tools:
  • get_manifest
  • get_workspace_context
  • get_capabilities
  • validate_strategy
  • create_strategy
  • finalize_strategy_version
  • run_backtest
  • get_backtest
Recommended validate_strategy input shape:

Suggested system prompt

Give your AI model a system prompt that enforces the capability contract and validate-repair loop.

Repair loop template

When validation fails, repair the specific issues rather than regenerating the entire strategy. Here’s a template for a deterministic repair loop.

Tips

  • Start simple. One trigger plus one confirmation filter is much easier to repair than a complex multi-branch graph.
  • Cache capabilities. Cache the response from GET /public/v1/capabilities per workspace tier, and refresh when the subscription changes.
  • Use issue codes for repairs. Deterministic repair rules based on issue.code are more reliable than asking the model to reinterpret error messages.
  • Fix errors first, warnings second. Feed the repair loop only blocking issues initially — handle warnings in a second pass once the payload is valid.