Workflows
The paths your agent takes from a question to an answer. Each step names the tools it uses; the tool reference has their full signatures.
Choose the right environment
- Orient.
whoamifor the account and scopes, thenlist_environments— a saved environment may already answer the question. - Ready or custom. Market, Exchange, Council and Dispute run without authoring. Anything else is built as a custom environment: one JSON contract in the Environments SDK language.
- Define the question. Participants or process, time horizon, the inputs you control, decision rules and the outputs to measure. Real-world assumptions that are not supported by data are labelled as assumptions.
Run a ready environment
For Market (a consumer market reacting to a product), Exchange (a trading venue), Council (a panel deliberating a question) and Dispute (a case argued to a verdict).
list_fareground_environments— each environment's settings with types and defaults, and its catalog: presets, products, instruments.prepare_fareground_session(environment, config)— creates the session unstarted and free, with a page where you review and edit it.- For a dispute,
write_dispute_case_filerecords your side of the case while it is being prepared, before it starts. start_fareground_session— starts it, billed. Failed attempts count toward the run limits you asked for, so your agent does not restart or replace them on its own.get_fareground_session— progress, or the recorded outcome.get_fareground_session_evidence— the evidence behind it: for Exchange the seed history and price and news bars, for Market the roster, purchases and full reports. Page withafteruntilnext_afteris null.
Answer a question in one call
When you asked for a result, your agent can run a whole custom study in a single call.
- Read
environment_authoring_guide()and the closest engine (list_environment_engines,get_environment_engine). - Write the contract for the question: rules, actions, information, outputs.
- Work out known-answer cases — expected outputs at the actual inputs and horizon.
simulate_custom_environment(contract, request_id, cases, question, input_values, agent_bindings, n_runs, max_rounds, datasets, comparison, fit_patterns):agent_bindings— who plays each role: a model with instructions, or a coded policy.datasets— CSV, JSON or JSONL data for table and list inputs.comparison— 2 to 8 labelled conditions run side by side, each with a known-answer case.- It saves the environment, verifies the cases and runs the agents. If a check fails, no runs are queued and nothing is billed for runs.
- Follow the returned
operation_idwithget_custom_study(or stop it before admission withstop_custom_study), thenget_custom_runorwait_for_custom_runfor the results.
Build a custom environment step by step
The loop is write → check → save → preview → probe and verify → run → report.
- Write.
environment_authoring_guide()opens on a worked contract;coremaps every other part (cookbook,expressions,actions,events,inputs,patterns…).environment_contract_schema(path)gives exact fields. Or start from an engine:list_environment_engines, thenget_environment_enginefor an executable starter. Every number in the brief becomes an input whose default is that number. - People.
sample_personascreates a reproducible cohort with its sampling provenance. A role with a codedpolicyplays without model calls — right for crowds and baselines; a role without one takes a model seat in paid runs. - Check.
check_environment_contract(contract, input_values)returns each issue with apath,messageandfix, plus presentation issues — what people will read on the environment and run pages. A pass means the contract loads, not that it is right. - Save.
create_custom_environmentreturns anidandrevision.get_environment_pageshows it as people will see it. - Preview.
preview_custom_environmentresolves real entity IDs and stages, and shows exactly what one participant reads and which actions it has. - Probe and verify.
probe_custom_environmentruns a free structural play, random or scripted.verify_custom_environmentruns up to eight known-answer cases against one saved revision.analyze_custom_environmentsamples input boundaries for rule failures.fit_custom_environmentfits declared patterns to supplied data, andimport_custom_datasetloads a table input from CSV, JSON or JSONL. - Edit.
get_custom_environmentfor the current contract and revision.patch_custom_environmentreplaces chosen top-level sections;update_custom_environmentreplaces the whole contract. Both needexpected_revision, and both invalidate earlier checks — preview and verify again.
None of these checks establishes real-world accuracy; they establish that the environment does what its contract says.
Run and read results
- Before a paid run, the current revision needs a passing probe or verification with the
exact inputs, through at least the requested number of rounds. Your agent checks
get_balanceandget_cost_estimatesand starts small. - Start.
start_custom_run(environment_id, request_id, n_runs, max_rounds, input_values). Run i uses seed i. On an uncertain start it retries with the same request ID. - Follow.
wait_for_custom_run(returns within 30 seconds; a timeout does not cancel) orget_custom_run— each run's outcomes and execution quality, and the report across completed seeds once all runs finish. - Read.
get_custom_run_datapages through one run'sinputs,outputs,series,diagnostics,agent_bindings,contractordecisions.set_environment_metricschooses which results the report leads with.list_custom_runsrecovers earlier sessions;stop_custom_runcancels. - Report honestly. The modeled rules, inputs and their sources, run count, spread, failed runs and limits. Simulated outcomes are kept apart from observed data; one run, a passing probe or a valid contract is not proof of predictive accuracy.
Scenario-format environments
The older format, still supported for environments saved in it. New work is built as custom environments.
get_environment— the full definition;list_mechanisms,list_outcome_optionsandlist_patternsshow the building blocks;autofill_environmentgrounds inputs where research is available.run_environmentwith a UUIDrequest_idstarts an ensemble — independent simulations differing only by seed.use_llm=Falseis a free structure check, not evidence.get_runorwait_for_run, thenget_run_reportandget_run_events.extend_runadds runs;cancel_runstops them;list_runsfinds earlier ones. The spread across the ensemble is the result.