Skip to content

Agent Quickstart / agent serve

The entry command is trust-runtime agent serve, so this is also the right page when you are searching for agent serve.

What an agent needs first

At minimum, an agent should know how to:

  1. inspect project shape
  2. read and write files
  3. run diagnostics
  4. preview formatting
  5. build or test
  6. close the diagnose -> build -> reload loop

Start agent serve

trust-runtime agent serve --project ./my-plc

Transport details:

  • JSON-RPC 2.0
  • stdio only in v1
  • one request per line
  • one response per line

Five-minute Example

1. Describe the agent API

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"agent.describe","params":{}}' \
  | trust-runtime agent serve --project ./examples/memory_marker_counter

2. Inspect the project

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"workspace.project_info","params":{}}' \
  | trust-runtime agent serve --project ./examples/memory_marker_counter

3. Read diagnostics

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"lsp.diagnostics","params":{}}' \
  | trust-runtime agent serve --project ./examples/memory_marker_counter

4. Preview formatting without mutating disk

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"lsp.format","params":{"path":"src/Main.st"}}' \
  | trust-runtime agent serve --project ./examples/memory_marker_counter

5. Close the write -> validate -> reload loop

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"runtime.compile_reload","params":{}}' \
  | trust-runtime agent serve --project ./examples/memory_marker_counter

Methods most agents use first

  • agent.describe
  • workspace.project_info
  • workspace.read
  • workspace.write
  • lsp.diagnostics
  • lsp.format
  • runtime.build
  • runtime.test
  • runtime.compile_reload

Deterministic execution

Use the harness APIs when you need programmable cycle control:

  • Harness protocol
  • harness.load
  • harness.cycle
  • harness.set_input
  • harness.get_output
  • harness.run_until