[Agent Session] `session.run` Does Not Return the Actual Model, Making the Final Model Route Impossible to Verify

Summary

I tested the following APIs directly through the Anna App Runtime:

  • Create an agent.session;
  • Run one request through that Session with agent.session.run;
  • Run one llm.complete request for comparison.

The llm.complete response includes the actual model used, but the Agent Session create response, run acknowledgement, and stream frames from this run did not include an actual model field. As a result, the client can only see the model preference submitted in the request and cannot verify which model the server ultimately routed the request to.

Reproduction details

The test was performed in an Anna App local development environment, using the same user permissions and a simple text prompt. The examples below are the key RPC requests, responses, and stream frames captured by the client.

The Session was created with:

{
  "submode": "auto",
  "quotaCaps": {
    "inherit_host_tools": false,
    "allowed_tools": ["fs_read_file"]
  }
}

The subsequent agent.session.run request was:

{
  "app_session_uuid": "aps_kc4qbtiyfuktndila26hbs",
  "content": "hi",
  "modelPreferences": {
    "hints": [
      { "name": "google/gemini-3-flash-preview" }
    ]
  }
}

Session responses observed

1. agent.session.create response

{
  "app_session_uuid": "aps_kc4qbtiyfuktndila26hbs",
  "expires_in": 600,
  "submode": "auto",
  "fixed_client_id": null,
  "granted_tools": []
}

There is no model or model_name field. This is understandable because no model inference has been executed at the time the Session is created.

2. Immediate agent.session.run response

{
  "stream_id": "dev-1",
  "run_id": "dev-1"
}

This response only provides stream and run identifiers; it does not include model information.

3. agent.session.run stream frames

The run_meta frame received when execution started was:

{
  "event": "run_meta",
  "run_id": "6ce81be3-a162-4d51-aabd-603d86fda4ae",
  "app_session_uuid": "aps_kc4qbtiyfuktndila26hbs",
  "submode": "auto",
  "inherit_host_tools": false,
  "granted_tools": ["fs_read_file"]
}

The task completion frame contained token usage:

{
  "task_complete": {
    "task_id": "95a86d5a-4213-470e-8f35-d174a61d7b47",
    "status": "completed",
    "token_usage": {
      "total_calls": 1,
      "total_prompt_tokens": 317,
      "total_completion_tokens": 9,
      "total_tokens": 326,
      "total_estimated_cost": 0.000186,
      "agent_turn_id": "e9ef90ff-589"
    }
  }
}

Neither run_meta nor task_complete contains model or model_name. The final text frame only contains the generated content:

{
  "choices": [
    {
      "delta": {
        "content": "Hello! How can I help you today?"
      }
    }
  ],
  "event": "sse"
}

Comparison: llm.complete returns the actual model

For the same input, hi, the llm.complete response included:

{
  "role": "assistant",
  "content": {
    "type": "text",
    "text": "Hello! How can I help you today?"
  },
  "model": "google/gemini-3-flash-preview",
  "stopReason": "endTurn",
  "usage": {
    "inputTokens": 1,
    "outputTokens": 9,
    "totalTokens": 10
  },
  "_meta": {
    "provider": "openrouter",
    "latencyMs": 1036,
    "quotaConsumed": 0.023275862068965515,
    "appSessionUuid": "aps_hq33od2vzgapjnbtfaxzhc"
  }
}

This response explicitly reports model: "google/gemini-3-flash-preview".

The following field in the Session request:

"modelPreferences": {
  "hints": [{ "name": "google/gemini-3-flash-preview" }]
}

only represents the model preference submitted by the client. It is not equivalent to the model ultimately used by the server. Routing may be affected by user authorization, model availability, or other server-side policies. If the server performs a fallback, the client currently has no way to detect it from the Session response.

Also, the appSessionUuid in the llm.complete response (aps_hq33...) is different from the raw Agent Session’s app_session_uuid (aps_kc4q...). Therefore, the model returned by llm.complete cannot be used to infer the actual model used by the raw Agent Session.

Impact

Without the actual model information, it is difficult to:

  1. Verify whether modelPreferences was honored;
  2. Detect model fallback or routing discrepancies;
  3. Reliably associate token usage, latency, and cost with a specific model;
  4. Debug output differences between models using server-side execution data rather than only the request parameters;
  5. Perform production auditing and troubleshooting with complete runtime metadata.

Expected behavior

Please expose the actual model used for every agent.session.run, in at least one of the following locations:

  • run_meta.model or run_meta.model_name;
  • task_complete.model or task_complete.model_name;
  • A standardized model field in the final completion frame.

It would also be helpful if the documentation clarified:

  1. Whether modelPreferences.hints is a preference or a hard requirement;
  2. Whether fallback is allowed when the preferred model cannot be used;
  3. Which frame contains the actual model, including the field name and format;
  4. Whether an explicit “model unavailable” or “model not disclosed” status can be returned when the model cannot be exposed for policy reasons.

Since llm.complete already returns model, providing equivalent actual-model metadata for Agent Sessions would make the two invocation paths much easier to observe and troubleshoot consistently.

Correlation identifiers

The following identifiers may help with server-side investigation:

  • app_session_uuid: aps_kc4qbtiyfuktndila26hbs
  • stream_id: dev-1
  • run_id (from the run_meta frame): 6ce81be3-a162-4d51-aabd-603d86fda4ae
  • task_id: 95a86d5a-4213-470e-8f35-d174a61d7b47
  • agent_turn_id: e9ef90ff-589

I can provide the complete raw RPC log if needed.

Hi @HappyLight! :waving_hand:

Thank you for this wonderfully detailed report — the captured frames and correlation IDs made it a breeze to trace. You’re absolutely right: there was no way to verify the final model route from an Agent Session, and that’s now fixed! :tada:

:white_check_mark: What’s coming in 1.1.0-beta.155

Every agent.session.run now discloses the actually-routed model in two places:

  1. run_meta frame — now carries model and provider:

    { "event": "run_meta", "run_id": "…", "model": "google/gemini-3-flash-preview", "provider": "openrouter", "granted_tools": [], … }
    

    It’s emitted after the server finishes model resolution (including any fallback), so you can verify the route before consuming a single token. :magnifying_glass_tilted_left:

  2. task_complete delta — echoes the same model / provider alongside token_usage, so usage, latency, and cost can be attributed to a specific model:

    { "task_complete": { "task_id": "…", "status": "completed", "model": "…", "provider": "…", "token_usage": { … } } }
    

The model value follows the exact same naming convention as llm.complete’s model field — the two paths are now consistent and auditable. :sparkles:

:open_book: Your documentation questions — answered (and now in the docs!)

  1. Is modelPreferences.hints a preference or hard requirement? A soft preference — it nudges the router but never fails the run.
  2. Is fallback allowed? Yes — if the hinted model can’t be used (availability, authorization, etc.), the server falls back rather than failing your run. The new fields make any fallback visible.
  3. Which frame contains the actual model? Both run_meta (pre-token, authoritative) and task_complete (terminal, for accounting).
  4. “Model not disclosed” status? Not needed — the routed model is always disclosed, same as llm.complete.

The Host API reference for agent.session.run has been updated with all of the above, and the anna-app-llm-demo / anna-app-session-demo examples now display the routed model too. :books:

:spiral_calendar: Rollout

Shipping to production this Friday. The change is fully backward-compatible — the new fields simply appear on existing frames, nothing else about the stream shape changes.

Thanks again for pushing the platform’s observability forward — reports like this one are exactly what makes the developer experience better for everyone. Happy building! :yellow_heart: