autonomous-handle

command
v2.8.0-dev.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

README

autonomous-handle — Pause / Resume / Inject / Stop on a live run

What this shows

The autonomous.Handle control API: autonomous.Start launches the loop on a goroutine and returns a handle you steer from outside. The example pauses the run mid-flight, queues a message with Inject (it lands on the next turn's prompt as an [Inbox] block), resumes, waits for the bounded run to finish, and calls Stop (idempotent, safe after terminal).

No LLM credentials — the model is the echo mock wrapped in a small slowLLM delay shim so the example has a wide-enough window to pause between turns (real network latency gives you the same window).

Run it

No credentials needed, runs offline:

go run ./examples/autonomous-handle

Takes a couple of seconds (three 400 ms echo turns plus the pause).

Key APIs

  • autonomous.Startgithub.com/go-steer/core-agent/v2/pkg/agent/autonomous
  • autonomous.Handle.Pause / .Resume / .Inject / .Wait / .Stop / .Status
  • autonomous.WithMaxTurns / autonomous.WithMaxWallclock — run budgets
  • mock.NewEchogithub.com/go-steer/core-agent/v2/pkg/models/mock

What you should see

== autonomous.Start ==
  status: running
== Pause ==
  status: paused
== Inject ==
  queued: "priority changed: hello from the example"
== Resume ==
  status: running
== Wait ==
  reason:    max_turns_exceeded
  turns:     3
  finalText: "continue"
  status:    failed

(The echo agent never calls report_done, so the bounded run ends by max_turns_exceeded rather than completing.)

Next

Documentation

Overview

Example: drive an autonomous run via the AutonomousHandle API. Demonstrates Pause / Resume / Inject / Stop without LLM credentials by using the echo mock provider as the model.

The "agent" just echoes whatever prompt it sees, so the trace shows: - Initial turn with the goal - Pause + Resume (visible as a gap in the activity log) - Inject() arriving on the post-pause turn as an [Inbox] block - Stop tearing the goroutine down

go run ./examples/autonomous-handle

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL