SDK Tutorials

A collection of step-by-step guides designed to take you from basic usage to advanced agentic patterns. Each lesson introduces one new concept.

1. Basic Usage

Initialize the client and make a basic streaming request.

Basics

2. System Messages

Guide the AI's personality and behavior with system prompts.

Basics

3. Model Selection

Switch between different models (Google, OpenAI, etc.).

Basics

4. Media Messages

Send images to multimodal (vision) models.

Basics

5. Multi-turn Chat

Build an interactive chat by maintaining conversation history.

Basics

6. Parameter Control

Control creativity and output with parameters like `temperature`.

Basics

7. Guaranteed JSON Output

Force guaranteed, parsable JSON output from the model.

Advanced Pattern

8. Basic Tool Usage

Enable models to use tools with the high-level `.run()` agent.

Agentic Flow

9. Advanced Parallel Tools

Make multiple, concurrent tool calls for complex queries.

Agentic Flow

10. Structured Extraction

Use a tool's schema to extract structured data from text.

Advanced Pattern

11. Multi-Turn Clarification

Build an agent that asks clarifying questions before using a tool.

Agentic Flow

12. Parallel Extraction

A powerful pattern for extracting multiple items in a single pass.

Advanced Pattern

13. Automated Token Management

Persist refreshed authentication tokens automatically for seamless long-term operation.

SDK Feature

14. Observability & Error Handling

Build resilient apps with event listeners and structured error handling.

SDK Feature

15. The Manual Tool-Use Loop

Deconstruct the `.run()` agent to gain full control over the tool-use flow.

Agentic Flow

16. Forcing Tool Usage

Make agent behavior more reliable by forcing the model to use a tool.

Agentic Flow

17. Multimodal Agents

Build agents that can see and act by combining vision with tool use.

Advanced Pattern

18. Dynamic Tool Selection

Create efficient agents by selecting relevant tools based on the prompt.

Advanced Pattern

19. Using the Task API

Use the specialized Task API for non-chat interactions.

Task API

20. Advanced Code Generation

Use prefix and suffix to generate code in the middle of a file.

Task API

21. Task API Observability

Listen to streaming events to observe task execution.

Task API

22. Chaining Task and Chat APIs

Combine Task and Chat APIs for complex workflows.

Task API