Skip to content

Getting Started

This guide will walk you through the process of setting up and using the Tiptree Platform for the first time.

Before you begin, ensure you have:

  • A Tiptree Platform account (for the managed service) or a self-hosted installation
  • API credentials (API key or OAuth client credentials)
  • Python 3.8+ or Node.js 14+ for using the client libraries

Install the Python client library using pip:

Terminal window
pip install tiptree-client

Install the TypeScript client using npm or yarn:

Terminal window
npm install @tiptree/client
# or
yarn add @tiptree/client
# Python
from tiptree.client import TiptreeClient
client = TiptreeClient(api_key="your-api-key")
// TypeScript
import { TiptreeClient } from '@tiptree/client';
const client = new TiptreeClient({
apiKey: 'your-api-key'
});
# Python
from tiptree.client import TiptreeClient
client = TiptreeClient(
client_id="your-client-id",
client_secret="your-client-secret"
)
// TypeScript
import { TiptreeClient } from '@tiptree/client';
const client = new TiptreeClient({
clientId: 'your-client-id',
clientSecret: 'your-client-secret'
});

Agents are the core building blocks of the Tiptree Platform. Here’s how to create a simple agent:

# Python
agent = client.agents.create(
name="My First Agent",
description="A simple agent for testing",
model="gpt-4",
system_prompt="You are a helpful assistant that provides concise answers."
)
print(f"Agent created with ID: {agent.id}")
// TypeScript
const agent = await client.agents.create({
name: "My First Agent",
description: "A simple agent for testing",
model: "gpt-4",
systemPrompt: "You are a helpful assistant that provides concise answers."
});
console.log(`Agent created with ID: ${agent.id}`);

To interact with an agent, you need to create a session:

# Python
session = client.sessions.create(agent_id=agent.id)
print(f"Session created with ID: {session.id}")
// TypeScript
const session = await client.sessions.create({
agentId: agent.id
});
console.log(`Session created with ID: ${session.id}`);

Once you have a session, you can send messages to the agent:

# Python
response = client.messages.send(
session_id=session.id,
content="What's the capital of France?"
)
print(f"Agent response: {response.content}")
// TypeScript
const response = await client.messages.send({
sessionId: session.id,
content: "What's the capital of France?"
});
console.log(`Agent response: ${response.content}`);

You can retrieve the message history for a session:

# Python
messages = client.messages.list(session_id=session.id)
for message in messages:
print(f"{message.role}: {message.content}")
// TypeScript
const messages = await client.messages.list({
sessionId: session.id
});
messages.forEach(message => {
console.log(`${message.role}: ${message.content}`);
});

Agents can be configured with tools to perform actions:

# Python
agent_with_tools = client.agents.create(
name="Weather Agent",
description="An agent that can check the weather",
model="gpt-4",
system_prompt="You are a helpful assistant that can check the weather.",
tools=[
{
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
}
]
)
// TypeScript
const agentWithTools = await client.agents.create({
name: "Weather Agent",
description: "An agent that can check the weather",
model: "gpt-4",
systemPrompt: "You are a helpful assistant that can check the weather.",
tools: [
{
name: "get_weather",
description: "Get the current weather for a location",
parameters: {
type: "object",
properties: {
location: {
type: "string",
description: "The city and state, e.g. San Francisco, CA"
}
},
required: ["location"]
}
}
]
});

Now that you’ve created your first agent and interacted with it, you can: