Skip to content

Add a loop-harness agent example - #1165

Open
PratikDhanave (PratikDhanave) wants to merge 1 commit into
microsoft:mainfrom
PratikDhanaveFork:feat/example-loop-harness
Open

PratikDhanave (PratikDhanave) wants to merge 1 commit into
microsoft:mainfrom
PratikDhanaveFork:feat/example-loop-harness

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

Go has full loop-harness support (agent/harness/loop) but examples/ has no sample demonstrating it — the .NET samples include a Harness set (Harness_Step05_Loop), and the parity doc lists "richer sample coverage" as a gap.

Change

  • New examples/02-agents/harness/step01_loop that wraps a Foundry agent with the loop middleware + a completion-marker evaluator, so the agent keeps working across turns until it ends a response with the TASK COMPLETE marker.
  • Registered in cmd/verifyexamples (env-gated on FOUNDRY_PROJECT_ENDPOINT, FOUNDRY_MODEL optional), matching the sibling agent samples. It skips cleanly when credentials are absent.

Builds, go vet, and gofumpt clean; the verifyexamples test passes and the new entry is discovered and skips without credentials.

Go has full loop-harness support (agent/harness/loop) but no sample
demonstrating it, unlike the .NET Harness samples. Add a get-it-working
example that wraps a Foundry agent with the loop middleware and a
completion-marker evaluator so the agent keeps working across turns until it
signals completion, and register it with cmd/verifyexamples (env-gated on
FOUNDRY_PROJECT_ENDPOINT like the sibling agent samples).
Copilot AI lite review requested due to automatic review settings September 23, 2026 04:37
@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

🟢 Approval recommended

Only a non-blocking documentation nit remains.

Review effort: Lite
Findings: None

What changed in this PR

Adds a Foundry-backed loop-harness agent example and registers it for environment-gated verification.

Changes:

  • Demonstrates completion-marker loop middleware.
  • Registers the sample with verifyexamples.
File Summary
examples/​02-agents/​harness/​step01_loop/​main.go New Foundry loop-harness sample.
cmd/​verifyexamples/​examples.go Registers the sample for verification.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added the kind:examples Changes examples or example-support metadata label Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Scope: examples

Changed Go contract: None (no exported API added/changed). New example examples/02-agents/harness/step01_loop/main.go and a corresponding entry registered in cmd/verifyexamples/examples.go. Both changes use pre-existing public APIs (agent/harness/loop.New, loop.NewCompletionMarkerEvaluator, foundryprovider.NewAgent) without modification.

Upstream evidence reviewed: dotnet/samples/02-agents/Harness/Harness_Step05_Loop/Program.cs (Harness_Step05_Loop sample) — specifically its Pattern 1 "Completion-marker (Ralph-style) loop" using LoopAgent + CompletionMarkerLoopEvaluator. The Go example's loop.New + loop.NewCompletionMarkerEvaluator(loop.CompletionMarkerConfig{Marker: completionMarker}) wrapping a Foundry-backed agent is a direct conceptual match for this pattern (re-invoke the agent until it emits a completion marker in its response). No Python samples/ equivalent was found for the Harness/loop scenario; Go and .NET currently lead on this sample area, which is consistent with the PR's stated goal of closing a documented Go sample-coverage gap.

Result: aligned. This PR only adds a new example and registers it in the example-verification harness; it introduces no new or changed exported Go API and no behavior change to agent/harness/loop. The example correctly demonstrates the existing loop-harness middleware and mirrors the completion-marker pattern from the upstream .NET Harness_Step05_Loop sample (one of its four patterns — the other three, e.g. todo-based and AI-judge loops, are not covered here but that's an acceptable, non-blocking scope choice for an initial sample). No parity issues found.

Generated by Go API Consistency Review Agent · copilot · auto · 28.7 AIC · ⌖ 6.85 AIC · ⊞ 9.2K ·

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.

2 participants