Repository navigation
Replaying an AgentScope run with no provider reachable — and one thing that will never reproduce #2614
xizhuomengcontin
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I record model traffic at the HTTP boundary — from outside the process — and serve the recording back so a run happens again with no provider called. Ran it against AgentScope 2.0.8 tonight. It captures with no code change, and while checking the result I noticed something about message ids that anyone writing tests here will want to know.
Capture needs no configuration
OpenAIChatModelbuilds its client as:OpenAICredential.base_urldefaults toNone, and the OpenAI SDK then falls back toOPENAI_BASE_URLfrom the environment — which is what a recorder sets for the child process it launches, and only for that process. So this is captured as written:Then with the origin process killed:
exact=1— the outbound request matched the recording byte for byte: formatter output, message blocks, parameters. The model class, the formatter and your own code run for real; only the answer comes from the trace.Nice consequence of the credential design: because
base_urllives on the credential rather than being read from the environment by AgentScope itself, setting it explicitly (OpenAICredential(api_key=..., base_url="http://127.0.0.1:8080/v1")) is a first-class way to point a run at a local endpoint, without touching global environment state that other models in the same process would also see.The thing that will not reproduce, and it is not the model
Comparing the two runs above — identical request, identical recorded response — the returned block differs:
AgentScope mints a fresh id (and
created_at) per block on the response side, so those fields vary run to run even when the provider returned the exact same bytes. That is clearly deliberate — blocks need identity — but it has a practical consequence: any test that asserts on a wholeMsg/TextBlock, or snapshots one, will be non-deterministic regardless of how deterministic the model is. Assert on.textand the block type, or stripid/created_atbefore comparing.It does not affect replay fidelity — the comparison is on the outbound request — but it would quietly break a golden-file test, and the failure would look like model non-determinism when it isn't. Worth a line in the testing docs, if there isn't one already.
Limits
OpenAIEmbeddingModelat query time cannot be fully replayed today. Saying so rather than letting someone find out mid-run.agentscope2.0.8 on Python 3.12 against a deterministic local origin standing in for a provider, non-streaming, no tools. Streaming and tool paths are untested here.Tool is OrcaReplay (Apache-2.0, npm, Node 20+); I maintain it, so weigh accordingly. The block-id observation is about AgentScope and holds regardless of what produced the response.
All reactions