Skip to main content
This guide creates a reusable agent and environment, starts a session, and prints the agent’s response to its first message.

Prerequisites

You need:

1. Install the SDK

2. Set your API key

The SDK reads your API key from the FUNKY_API_KEY environment variable.
Keep your API key out of source control. In production, load it from your platform’s secret manager.

3. Create your first session

Create quickstart.py for Python or quickstart.ts for TypeScript. Add the snippet from each step to the file, in order.
1

Create an agent

An agent defines the model, system prompt, and tool policy. You can reuse the same agent across many sessions.
2

Create an environment

An environment configures the sandbox where the agent runs. This example limits outbound network access to GitHub.
3

Start a session

A session connects the agent to the environment for one independent task or conversation. Wait until its sandbox is ready before sending work.
4

Send a message

run_turn() and runTurn() send the message, follow session events until the turn completes, and return the agent’s response.
Run the completed file:
In an application, create agents and environments during setup and store their IDs. Reuse those IDs when you start a new session for each independent task.