Developer quickstart

Create your first Letta agent with the API or SDKs and view it in the ADE

This guide will show you how to create a Letta agent with the Letta APIs or SDKs (Python/Typescript). To create agents with a low-code UI, see our ADE quickstart.

1

Prerequisites

  1. Create a Letta Cloud account
  2. Create a Letta Cloud API key

You can also self-host a Letta server. Check out our self-hosting guide.

2

Install the Letta SDK

1pip install letta-client
3

Create an agent

1from letta_client import Letta
2
3client = Letta(token="LETTA_API_KEY")
4
5agent_state = client.agents.create(
6 model="openai/gpt-4.1",
7 embedding="openai/text-embedding-3-small",
8 memory_blocks=[
9 {
10 "label": "human",
11 "value": "The human's name is Chad. They like vibe coding."
12 },
13 {
14 "label": "persona",
15 "value": "My name is Sam, the all-knowing sentient AI."
16 }
17 ]
18)
19
20print(agent_state.id)
4

Message your agent

The Letta API supports streaming both agent steps and streaming tokens. For more information on streaming, see our streaming guide.

Once the agent is created, we can send the agent a message using its id field:

1response = client.agents.messages.create(
2 agent_id=agent_state.id,
3 messages=[
4 {
5 "role": "user",
6 "content": "hows it going????"
7 }
8 ]
9)
10
11for message in response.messages:
12 print(message)

The response contains the agent’s full response to the message, which includes reasoning steps (chain-of-thought), tool calls, tool responses, and assistant (agent) messages:

1{
2 "messages": [
3 {
4 "id": "message-29d8d17e-7c50-4289-8d0e-2bab988aa01e",
5 "date": "2024-12-12T17:05:56+00:00",
6 "message_type": "reasoning_message",
7 "reasoning": "User seems curious and casual. Time to engage!"
8 },
9 {
10 "id": "message-29d8d17e-7c50-4289-8d0e-2bab988aa01e",
11 "date": "2024-12-12T17:05:56+00:00",
12 "message_type": "assistant_message",
13 "content": "Hey there! I'm doing great, thanks for asking! How about you?"
14 }
15 ],
16 "usage": {
17 "completion_tokens": 56,
18 "prompt_tokens": 2030,
19 "total_tokens": 2086,
20 "step_count": 1
21 }
22}

You can read more about the response format from the message route here.

5

View your agent in the ADE

Another way to interact with Letta agents is via the Agent Development Environment (or ADE for short). The ADE is a UI on top of the Letta API that allows you to quickly build, prototype, and observe your agents.

If we navigate to our agent in the ADE, we should see our agent’s state in full detail, as well as the message that we sent to it:

Read our ADE setup guide →

Next steps

Congratulations! 🎉 You just created and messaged your first stateful agent with Letta, using both the Letta ADE, API, and Python/Typescript SDKs. See the following resources for next steps for building more complex agents with Letta: