Add an agent-mode harness example - #1167
PratikDhanave (PratikDhanave) wants to merge 1 commit into
Conversation
Go supports the agent-mode harness (agent/harness/agentmode) but has no sample. Add an example that attaches the agent-mode context provider (default plan/execute modes with mode_set/mode_get tools) to a Foundry agent so the agent plans then executes, and register it with cmd/verifyexamples.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The example does not reliably demonstrate execute-mode instructions and has a naming inconsistency.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Adds a session-backed Go example for the agent-mode harness and registers it with environment-gated verification.
Changes:
- Adds a plan/execute agent-mode sample with mode tools.
- Registers the sample with
verifyexamples.
| File | Summary |
|---|---|
examples/02-agents/harness/step03_agentmode/main.go |
Adds the agent-mode example. The execution flow should be split into planning and execution runs, and ModalAssistant should be renamed to ModeAssistant. |
cmd/verifyexamples/examples.go |
Registers the example for environment-gated verification. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| resp, err := a.RunText(ctx, | ||
| "I want to organize a small study group. First plan the steps, then switch to execute mode and carry them out.", | ||
| agent.WithSession(session)).Collect() | ||
| demo.Response(resp, err) |
| foundryprovider.AgentConfig{ | ||
| Instructions: "You are a capable assistant that follows the current operating mode's guidance.", | ||
| Config: agent.Config{ | ||
| Name: "ModalAssistant", |
|
Scope: examples (no public API change — Changed Go contract: None. No exported functions, types, or behavior changed. Upstream evidence reviewed:
Both upstream samples demonstrate the plan→execute switch via an interactive loop: the agent is run once per user turn, the user (or agent, via Result: Conceptually aligned with the upstream agent-mode harness (same tools, defaults, and session-backed mode state), but the Go example's single No label changes: no exported Go API surface changed (no
|


Continuing harness sample coverage (loop #1165, todo #1166): Go supports the agent-mode harness (
agent/harness/agentmode) butexamples/has no sample.Change
examples/02-agents/harness/step03_agentmodethat attaches the agent-mode context provider (default plan/execute modes, with themode_set/mode_gettools and per-mode instruction injection) to a Foundry agent, so the agent plans a task then switches to execute mode. Session-backed.cmd/verifyexamples(env-gated onFOUNDRY_PROJECT_ENDPOINT), skipping cleanly without credentials.Builds,
go vet,gofumptclean; theverifyexamplestest passes.