Qveris agent orchestrator.
The agent runs an LLM/tool loop that can:
Close network resources owned by the agent.
Call this when you are done with a long-lived Agent, or use the agent as an async context manager so cleanup happens automatically.
Return the latest conversation history produced by run(…).
The returned history includes intermediate assistant tool calls and tool results, plus the final assistant content when one was produced. If run(…) injected the default system prompt, that internal system message is omitted so callers can reuse the list directly.
Return the current budget state (limit / spent / remaining).
Returns None when no budget_credits was set. spent reflects pre-settlement charges from call responses; reconcile final charges with usage(...) / ledger(...).
Run the agent loop and yield events as they occur.
This is the primary integration API. In streaming mode (stream=True), the underlying provider is expected to yield delta content chunks; in non-streaming mode, this method yields a single content event for the assistant message.
Tool calls are always surfaced as tool_call events, and tool executions as tool_result.
Run the agent in non-streaming mode and return the final assistant text.
This is a convenience wrapper around run(messages, stream=False) that discards all events except content and returns the concatenated text.
Create and set a new session id.
The session id is forwarded to Qveris API calls (discover/call) and can be used server-side for correlation, tracing, and analytics.
Track and enforce a per-session credit budget.
None disables the tracker entirely.limit (default 0.8).expected_cost estimate while spent accumulates the actual (possibly larger) charge, so a call estimated under-budget that charges more can push spent past limit. The guard is only as tight as discover / inspect coverage — a call whose cost was never observed cannot be estimated and is not blocked.Agent session state, not per-run(). Don’t share one Agent across concurrent run() calls if you rely on the budget: they share and race spent.Cache expected_cost per tool_id from a discover/inspect payload.
Accepts a dict or a pydantic SearchResponse.
Return the cached cost estimate for tool_id, if known.
Return a block payload if calling tool_id would exceed the budget.
Returns None (allowed) when the tracker is disabled, the cost is unknown (cannot estimate, so not blocked), or the projected spend is within the limit.
Add the actual charge from a call result to cumulative spend.
Returns a warning payload the first time spend reaches warn_ratio * limit; otherwise None.
Return the current budget state (queryable, reconcilable with usage/ledger).
Was this page helpful?