Skip to main content

:::note Generated reference Generated from honeyframeapi 0.1.8 — do not edit by hand. :::

honeyframeapi.agent

Agent handle — chat with / run a Honeyframe agent from code.

agent = client.get_agent(agent_id=42)
reply = agent.ask("How many orders were cancelled last month?")
print(reply["answer"])

# multi-turn: reuse the returned session_id
r1 = agent.ask("Top 5 stores by volume?")
r2 = agent.ask("…and their cancellation rate?", session_id=r1["session_id"])

The platform exposes the agent library at GET /api/agents/library and invokes agents through POST /api/chat (JWT auth), where agent_id selects a published agent's tools/config.

class Agent​

Agent.title​

property

title: str

Agent.reload()​

reload() -> Agent

Fetch this agent's published-asset record (title, config, status).

Agent.ask()​

ask(message: str, *, session_id: Optional[int] = None, model: Optional[str] = None, webapp_key: Optional[str] = None, page_key: Optional[str] = None) -> dict

Send a message to this agent. Returns the chat response dict (answer, session_id, sql, rows, follow_ups, …). Pass session_id from a prior reply to continue the conversation.

webapp_key (with optional page_key) auto-grounds this agent in that webapp's dashboard cards when it runs in SQL mode — the same embedded-assistant grounding the webapp viewer applies.

Agent.ask_stream()​

ask_stream(message: str, *, session_id: Optional[int] = None, model: Optional[str] = None, persona: Optional[str] = None, webapp_key: Optional[str] = None, page_key: Optional[str] = None, history: Optional[list] = None, images: Optional[list] = None) -> Iterator[dict]

Stream this agent's reply as Honeyframe SSE events.

Mirrors ask but over /api/chat/stream, so you can render the answer token-by-token. Yields {"event", "data"} dicts (token / thinking / tool_start / tool_result / citation / artifact / usage / error / done). Fold the whole stream into one result with collect_stream:

for ev in agent.ask_stream("Top 5 stores by volume?"):
if ev["event"] == "token":
print(ev["data"]["text"], end="", flush=True)

persona picks a capability persona (e.g. director); it is intersected with the caller's scopes server-side, so it can only narrow.


Verified against honeyframeapi 0.1.8.