Skip to content

feat(finance_agent): enable session execution in default configs - #5492

Open
yaoyu-33 wants to merge 21 commits into
yuya/gymint-170-finance-agent-v2-sessionsfrom
yuya/gymint-134-finance-agent-sessions
Open

yaoyu-33 wants to merge 21 commits into
yuya/gymint-170-finance-agent-v2-sessionsfrom
yuya/gymint-134-finance-agent-sessions

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Main integration after the fix

Final head: 95a486692; integrated stack head: 95a486692, including main 72275b85d. Resolved the routing conflict by preserving main's pending-cleanup ownership behavior and the new expiration deadline. Both regression suites remain. Independent source recheck found no conflict-induced regression.

Post-merge workstation checks: SEC resources 118 passed, v2 resources 240 passed, finance agent + routing + base resources + new resources lifecycle/policy tests 383 passed (741 total). Full pre-commit was rerun on this tree. The real-model smokes below ran at c3dc26098 before this main integration; they have not been rerun on 95a486692. Fresh GitHub CI is required for the published heads.

AI review follow-up (November 8)

Inherited the expiration-routing fixes from #4948 and #5491; this PR's agent/config delta is unchanged.

Revision: c3dc26098; integrated validation tree: c3dc26098. The stack was updated with signed additive commits/merges, preserving its bases.

Workstation validation (Python 3.13.14):

  • python -m pytest resources_servers/finance_sec_search/tests -q -o addopts= -o log_cli=false: 117 passed.
  • python -m pytest resources_servers/finance_agent_v2/tests -q -o addopts= -o log_cli=false: 238 passed.
  • python -m pytest responses_api_agents/finance_agent/tests tests/unit_tests/server_runtime/test_session_routing.py tests/unit_tests/server_runtime/test_base_resources_server.py -q -o addopts= -o log_cli=false: 296 passed.
  • python -m pre_commit run --all-files: passed, including guardwords and import-linter. Pre-commit 3.8.0 was used for workstation Git compatibility.
  • The two added regressions in each resources suite fail against the original implementation and pass with the fix. They cover cross-worker expired verification/late close and expiration-record deadlines without another seed.

The shared routing change makes #4948 full-scope for CI. Full repository suites and benchmark score parity were not run locally. Earlier no-real-model statements below are historical; they were already superseded by the November 6 evidence.

Fresh bounded real-NIM smokes at the integrated fixed tree passed for both canonical resources configs (model nvidia/nemotron-3.5-lightning-30b-a3b, temperature 0, max 8192 output tokens, 8 agent steps). Each ran one controlled-report task through real HTTP policy/tools/retrieval/judge: rewards 1.0 / 1.0, 0 failures / 0 masked rows, expected parse/retrieve/submit calls (plus calculator for v2), both close endpoints HTTP 200, and zero document/time/episode-seed/active-agent state afterward. All task HTTP servers stopped. This does not establish full benchmark parity, CLI collection, or live SEC/Tavily/Tiingo coverage. Machine-local evidence: ws:/home/yuya/finance-ai-20261109/ (audit.json, runs/fixed-sec/, runs/fixed-v2/, test/hook logs); source/patch hashes are recorded.


Stack: #4948 → #5491 → this PR. The base is #5491's branch.

What and why

The finance agent can now serve agent sessions, and all five existing finance_sec_search / finance_agent_v2 resources and benchmark YAMLs select single_agent_turn_legacy directly. Existing --resources-server and --benchmark commands use session execution. The five alternative session YAMLs are removed; instance names, dataset paths and benchmark identities stay unchanged.

The Environment Server seeds resources and agent sessions, calls the agent's tool loop, closes the agent, verifies, then closes resources. The agent and these resources servers are restart_only: a retry starts the episode again from its input.

  • Agent sessions require one direct HTTP grant, refuse unsupported required MCP/sandbox grants, send tools through the grant URL/headers, and return the updated resources cookie jar at close.
  • Model calls retain the rollout prefix and session header. With capture enabled, close returns invocation/tool observations and model-call references.
  • Both resources configs request resources_tool_transports: [direct_http]. Benchmark configs rename the environment's resources reference alongside its agent reference. Resolution tests cover all five canonical paths and require exactly one correctly bound Environment Server.
  • The standard Vals loop policies stay unchanged. Newer BigFinance profiles and their relay configs are preserved; BigFinance's resources server does not yet serve episode sessions.
  • README instructions now describe the default session path and its scoring implications. No manifest/catalog entries or benchmark names are added.

This implements one agent's part of the session migration described in #4679; a separate public issue is unnecessary. Aggregate metrics continue forwarding to the resources server and do not depend on #5455.

Compatibility and scoring

Existing finance commands change failure accounting. The direct agent /run endpoint remains available, but the canonical configs now use Environment Server policy:

Event Default session behavior
Context overflow, including provider text carried by an HTTP 500 Incomplete response, verified
Other model HTTP 400/413/422 Verified
Model HTTP 408/425/429/5xx or transport failure Retryable failure, unscored
Other model HTTP 4xx Terminal failure, unscored
Seed, agent or verifier failure Classified by the Environment Server
Ordinary tool error/timeout Tool result returned to the model; verified
Configured tool abort, including FABv2 RetryExhaustedError Retryable failure, unscored

Previously the relay verified model errors and converted run exceptions into reward zero. Failed episodes are now excluded from scores by default; --resume retries retryable failures within its configured attempt bound. Consequently coverage and aggregate scores can differ from historical runs. +count_failure_classes_as_zero=[environment_server_failed] counts that broad failure class as zero, including seed/judge/verify failures. This smoke does not establish benchmark score parity.

Validation

Final source: f0b200ce6568ff02cbc2d51a6dd5d46ccb3d6b5b, tree 327cc3710857661f861b04f1b69169450228acf6.

Linux, Python 3.13.14; each server suite ran in a separate Python process from the final checkout:

  • python -m pytest responses_api_agents/finance_agent/tests tests/unit_tests/config/test_global_config.py tests/unit_tests/environment/test_benchmarks.py -q -o addopts= -o log_cli=false --disable-warnings: 469 passed.
  • python -m pytest resources_servers/finance_sec_search/tests -q -o addopts= -o log_cli=false --disable-warnings: 116 passed.
  • python -m pytest resources_servers/finance_agent_v2/tests -q -o addopts= -o log_cli=false --disable-warnings: 237 passed.
  • 822 passed total. pre-commit run --all-files and git diff --check passed. The private guardwords hook skipped its unavailable private catalog; all other applicable hooks passed. DCO sign-off present.
  • Independent review of the config migration found no confirmed defect. A concurrent upstream update was preserved by rebasing before final checks; source-import provenance was checked explicitly.

Real-model HTTP smokes used both canonical resources configs at this final source,
with stock Environment Server, agent, resources and vllm_model servers. Policy,
retrieval and judge used NIM nvidia/nemotron-3.5-lightning-30b-a3b; requests were
paced 30 seconds apart. A controlled annual-report fixture supplies 172.90 versus
150.00 million USD revenue.

Config Observed result
finance_sec_search.yaml Reward 1, judge rating 2, parse → retrieve → submit; judge recovered from two upstream 429s
finance_agent_v2.yaml Reward 1, parse → retrieve → calculator → submit; both rubric criteria passed, six real judge votes, no judge error

Both ended with done_tool, successful agent/resources close responses, zero
active agent states, empty captured document/start-time maps and stopped HTTP
servers. The renamed resources _episode_seeds map is covered by source review
and session tests; this driver did not directly capture that map. Both controllers
and the separate artifact/cleanup audit passed. Earlier provider failures and
source-path setup attempts were retained rather than counted as passes.

This is a bounded HTTP integration smoke, not a full gym eval run or a live
SEC/Tavily/Tiingo benchmark. The three benchmark overlays have config/test coverage;
the model runs cover the two resources configs. No relay A/B or statistical score
parity is claimed.

Remaining scope

The three-PR stack is ready for review. Full benchmark/provider qualification and current CI remain separate from this bounded smoke.

Two existing follow-ups remain outside the config migration:

  • Legacy truncate_on_overflow does not inspect the propagated HTTP error body's response_content; the session branch does.
  • Agent model failures currently surface under environment_server_failed, while the detailed model_request_error cause remains in partial-response metadata. Shared failure_report construction is follow-up work.

finance_agent's episode is seed, one /v1/responses loop, verify, which is
what single_agent_turn runs, but it served no agent sessions, so it could
run only behind the legacy_agent relay, where a crash repeats the whole
episode and run() turns any exception into reward 0.

- _seed_agent_session_state takes the session's one direct HTTP grant;
  every tool, submit_final_result included, is behind it. A seed with no
  grant, more than one, a required MCP grant or sandbox access is refused
  with AgentSeedRejectedError (a final 422).
- In a session, tool calls go to the grant's base URL with its headers and
  the resources cookie jar, and close returns the updated jar. Model calls
  carry the Environment Server's rollout prefix, so captured calls join the
  episode, and with model-call capture on, close returns the loop's
  observations: one invocation and a record per tool call.
- In a session, a failed model call marks the response failed with its
  cause through classify_outcome: model_request_error with the HTTP status,
  model_transport_error for a timeout or connection failure, else unknown.
  The Environment Server's outcome policy then grades a 400/413/422,
  retries a 408/425/429/5xx or transport failure, and fails other 4xx,
  instead of scoring an outage 0. Tool errors and the
  abort_on_tool_error_types abort are graded as before.
- The legacy /run path is unchanged, and so are the existing configs. New
  configs run each relay pairing behind single_agent_turn_legacy with
  resources_tool_transports: [direct_http], keeping the relay's instance
  names: finance_sec_search_single_agent_turn.yaml,
  finance_agent_v2_single_agent_turn.yaml and, for the benchmarks,
  config_single_agent_turn.yaml (FABv2) and
  config_{no_,}web_search_single_agent_turn.yaml (finance_sec_search).
- The agent README documents the session path and how outcomes differ;
  the benchmark and resources server READMEs say how to run it.

Closes GYMINT-134.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33
yaoyu-33 added this pull request to stack #5493 November 3, 2026 05:58
@copy-pr-bot

copy-pr-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33 yaoyu-33 changed the title yuya/gymint 134 finance agent sessions feat(finance_agent): serve agent sessions for single_agent_turn Nov 3, 2026
@yaoyu-33 yaoyu-33 added feature New capabilities, enhancements, or enablement work area:agent Agent harnesses and Responses API agent behavior labels Nov 3, 2026
@yaoyu-33

yaoyu-33 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 9c4e196

yaoyu-33 and others added 2 commits November 2, 2026 22:54
…mint-134-finance-agent-sessions

Brings in main via #4948 and #5491 (511e5ed).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 80abd08

yaoyu-33 and others added 2 commits November 3, 2026 19:50
…s servers

finance_agent seeds agent sessions, so list it in AGENT_SESSION_AGENT_TYPES. Name the
Resources Server in the five finance single_agent_turn_legacy configs, which main now
requires of every step environment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 67f09be

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 6, 2026 22:03
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 95a4866

Preserve finance session execution alongside main’s resources retry and masked verification options. Retain both test suites and clarify the options apply to the agent /run path.

Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 62b7146

@yaoyu-33
yaoyu-33 requested review from a team as code owners November 16, 2026 05:07
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 16, 2026 05:08
@github-actions

Copy link
Copy Markdown
Contributor

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test dc1d3fb

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 46840a7

This branch was previously deployed

1 inactive (outdated) deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants