Skip to content

Implement steer() method for SDK query interface#5

Open
pushkarsingh32 wants to merge 1 commit intoopen-gitagent:mainfrom
pushkarsingh32:feat/sdk-steer
Open

Implement steer() method for SDK query interface#5
pushkarsingh32 wants to merge 1 commit intoopen-gitagent:mainfrom
pushkarsingh32:feat/sdk-steer

Conversation

@pushkarsingh32
Copy link

Summary

  • Implement steer() on the Query interface using pi-agent-core's native agent.steer() API
  • Hoists agent reference to outer scope so steer() can access it from the returned Query object
  • Steer messages are queued and picked up between tool calls by the agent loop — no custom abort/re-prompt logic needed
  • Add steer() unit tests and an example script for manual verification

Changes

  • src/sdk.ts — Hoist _agent ref, implement steer() with UserMessage format
  • test/sdk.test.ts — Tests for steer (throws before agent loads, method exists on Query)
  • examples/test-steer.ts — Manual SDK steer test that forces tool calls and steers after 3s

Test plan

  • All 21 existing + new tests pass (npx tsx --test test/sdk.test.ts)
  • Manual test with examples/test-steer.ts confirms agent redirects mid-conversation
  • Reviewer: verify steer works with multi-tool-call agents

Use pi-agent-core's native agent.steer() API to allow redirecting
an agent mid-conversation. The steer message is queued and picked
up between tool calls by the agent loop, avoiding the need for
custom abort/re-prompt logic.

- Hoist agent reference to outer scope so steer() can access it
- Implement steer() using agent.steer() with UserMessage format
- Add steer() tests (throws before agent loads, method exists)
- Add examples/test-steer.ts for manual SDK steer verification
@vercel
Copy link

vercel bot commented Mar 14, 2026

@pushkarsingh32 is attempting to deploy a commit to the shreyas-lyzr's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant