Skip to content

Add an agent-mode harness example - #1167

Merged
Quim Muntal (qmuntal) merged 3 commits into
microsoft:mainfrom
PratikDhanaveFork:feat/example-agentmode-harness
Oct 5, 2026
Merged

Quim Muntal (qmuntal) merged 3 commits into
microsoft:mainfrom
PratikDhanaveFork:feat/example-agentmode-harness

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

Continuing harness sample coverage (loop #1165, todo #1166): Go supports the agent-mode harness (agent/harness/agentmode) but examples/ has no sample.

Change

  • New examples/02-agents/harness/step03_agentmode that attaches the agent-mode context provider (default plan/execute modes, with the mode_set/mode_get tools and per-mode instruction injection) to a Foundry agent, so the agent plans a task then switches to execute mode. Session-backed.
  • Registered in cmd/verifyexamples (env-gated on FOUNDRY_PROJECT_ENDPOINT), skipping cleanly without credentials.

Builds, go vet, gofumpt clean; the verifyexamples test passes.

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.
Copilot AI lite review requested due to automatic review settings September 23, 2026 04:49
@github-actions github-actions Bot added area:examples Changes files in the examples area area:tooling Changes files in the tooling area size:medium At most 100 changed lines across at most 5 files labels Sep 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity · 1 Low severity

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.

Comment on lines +48 to +51
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",
@github-actions github-actions Bot added the kind:examples Changes examples or example-support metadata label Sep 23, 2026
@github-actions

This comment has been minimized.

@qmuntal Quim Muntal (qmuntal) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix review findings.

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

API consistency review

Result Scope
out of scope examples

This PR only adds a new Go sample (examples/02-agents/harness/step03_agentmode/main.go) and registers it in cmd/verifyexamples/examples.go; it does not add, remove, or change any exported Go API or observable framework behavior — it exercises only the pre-existing agentmode.New, agentmode.Config, and agentmode.Provider.SetMode exports, so no cross-repo parity review is needed.

Generated by Go API Consistency Review Agent · copilot · auto · 33.2 AIC · ⌖ 7.94 AIC · ⊞ 13.9K · ◷

@qmuntal Quim Muntal (qmuntal) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix review findings.

@qmuntal
Quim Muntal (qmuntal) added this pull request to the merge queue Oct 5, 2026
Merged via the queue into microsoft:main with commit 01090c9 Oct 5, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:examples Changes files in the examples area area:tooling Changes files in the tooling area kind:examples Changes examples or example-support metadata size:medium At most 100 changed lines across at most 5 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants