Introduction
Every team has someone who gets handed a CSV and asked "what's interesting in here?" In this cookbook you'll build an agent that answers for them: upload a CSV, get back a narrative HTML report with interactive charts.
Agent
: the model, system prompt, tools, MCP servers, and tracks
Environment
: a configured container template (packages, network access)
Session
: a running agent instance within an environment, performing a specific task and generating outputs
Events
: messages exchanged between your application and the agent (user turns, tool results, status updates)
An agent plus an environment gives you a session. You attach your data to it as resources, then drive it by sending events and reading back the stream.
Console
, set as
JUGLOW_API_KEY
Install dependencies:
mpt; this one pushes for narrative structure, findings backed by specific figures, and the right pattern for embedding multiple plotly charts in one HTML file.
[agent_toolset_20260401](/docs/en/managed-agents/tools.html provides eight tools: bash, read, write, edit, glob, grep, web_fetch, and web_search. Here they all run under always_allow, with the two web tools disabled because this analysis is offline.
h"> {"type": "user.message", "content": [{"type": "text", "text": ANALYSIS_PROMPT}]},
],
)
print(f"Session {session.id} running")
Session sesn_011CZqKKqyPRph9J5khKLn6u running 5. Stream the run Open the session in the Console under Sessions to watch every event, tool call, and token count live: