Create Session
Create a session for tembo to start working on in the background
import Tembo from '@tembo-io/sdk';
const client = new Tembo({
apiKey: 'My API Key',
});
const session = await client.session.create({
prompt: 'Fix the authentication bug in the login component',
agent: 'claudeCode:claude-opus-4-5',
repositories: [
'https://github.com/org/repo',
'https://gitlab.com/org/repo-2',
],
targetBranch: 'dev',
branchName: "cooper-is-awesome",
});
console.log(session.id);curl --request POST \
--url https://api.tembo.io/session/create \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Fix the authentication bug in the login component",
"description": "Users are reporting they cannot log in. JWT token validation appears to be failing.",
"agent": "claudeCode:claude-opus-4-5",
"repositories": [
"https://github.com/org/repo",
"https://gitlab.com/org/repo-2"
],
"codeRepoIds": [
"cbad4334-c844-4fef-a8da-d08f209f267e",
"6307d53a-b99d-4e90-ab89-f29114f33d53"
],
"targetBranch": "main",
"branchName": "feature/auth-fix",
"queueRightAway": false
}
'import requests
url = "https://api.tembo.io/session/create"
payload = {
"prompt": "Fix the authentication bug in the login component",
"description": "Users are reporting they cannot log in. JWT token validation appears to be failing.",
"agent": "claudeCode:claude-opus-4-5",
"repositories": ["https://github.com/org/repo", "https://gitlab.com/org/repo-2"],
"codeRepoIds": ["cbad4334-c844-4fef-a8da-d08f209f267e", "6307d53a-b99d-4e90-ab89-f29114f33d53"],
"targetBranch": "main",
"branchName": "feature/auth-fix",
"queueRightAway": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tembo.io/session/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => 'Fix the authentication bug in the login component',
'description' => 'Users are reporting they cannot log in. JWT token validation appears to be failing.',
'agent' => 'claudeCode:claude-opus-4-5',
'repositories' => [
'https://github.com/org/repo',
'https://gitlab.com/org/repo-2'
],
'codeRepoIds' => [
'cbad4334-c844-4fef-a8da-d08f209f267e',
'6307d53a-b99d-4e90-ab89-f29114f33d53'
],
'targetBranch' => 'main',
'branchName' => 'feature/auth-fix',
'queueRightAway' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tembo.io/session/create"
payload := strings.NewReader("{\n \"prompt\": \"Fix the authentication bug in the login component\",\n \"description\": \"Users are reporting they cannot log in. JWT token validation appears to be failing.\",\n \"agent\": \"claudeCode:claude-opus-4-5\",\n \"repositories\": [\n \"https://github.com/org/repo\",\n \"https://gitlab.com/org/repo-2\"\n ],\n \"codeRepoIds\": [\n \"cbad4334-c844-4fef-a8da-d08f209f267e\",\n \"6307d53a-b99d-4e90-ab89-f29114f33d53\"\n ],\n \"targetBranch\": \"main\",\n \"branchName\": \"feature/auth-fix\",\n \"queueRightAway\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tembo.io/session/create")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"Fix the authentication bug in the login component\",\n \"description\": \"Users are reporting they cannot log in. JWT token validation appears to be failing.\",\n \"agent\": \"claudeCode:claude-opus-4-5\",\n \"repositories\": [\n \"https://github.com/org/repo\",\n \"https://gitlab.com/org/repo-2\"\n ],\n \"codeRepoIds\": [\n \"cbad4334-c844-4fef-a8da-d08f209f267e\",\n \"6307d53a-b99d-4e90-ab89-f29114f33d53\"\n ],\n \"targetBranch\": \"main\",\n \"branchName\": \"feature/auth-fix\",\n \"queueRightAway\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tembo.io/session/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"Fix the authentication bug in the login component\",\n \"description\": \"Users are reporting they cannot log in. JWT token validation appears to be failing.\",\n \"agent\": \"claudeCode:claude-opus-4-5\",\n \"repositories\": [\n \"https://github.com/org/repo\",\n \"https://gitlab.com/org/repo-2\"\n ],\n \"codeRepoIds\": [\n \"cbad4334-c844-4fef-a8da-d08f209f267e\",\n \"6307d53a-b99d-4e90-ab89-f29114f33d53\"\n ],\n \"targetBranch\": \"main\",\n \"branchName\": \"feature/auth-fix\",\n \"queueRightAway\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"description": "<string>",
"status": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"htmlUrl": "https://app.tembo.io/sessions/123e4567-e89b-12d3-a456-426614174000"
}{
"error": "<string>"
}{
"error": "<string>"
}Body
Session creation payload
- Option 1
- Option 2
Description of the session to be performed. Supports tagging files.
1"Fix the authentication bug in the login component"
Detailed description of the session (alternative to prompt)
1"Users are reporting they cannot log in. JWT token validation appears to be failing."
The agent to use for this session
"claudeCode:claude-opus-4-5"
Array of code repository urls that this session relates to
[
"https://github.com/org/repo",
"https://gitlab.com/org/repo-2"
]Array of Tembo code repository IDs to target directly
[
"cbad4334-c844-4fef-a8da-d08f209f267e",
"6307d53a-b99d-4e90-ab89-f29114f33d53"
]The branch to open the pull request against (e.g. main, develop)
"main"
The branch name to use for the work
"feature/auth-fix"
Whether to immediately queue the session for processing (optional, defaults to true)
false
Response
Session created successfully
URL to view this session in the Tembo web application
"https://app.tembo.io/sessions/123e4567-e89b-12d3-a456-426614174000"
Was this page helpful?
import Tembo from '@tembo-io/sdk';
const client = new Tembo({
apiKey: 'My API Key',
});
const session = await client.session.create({
prompt: 'Fix the authentication bug in the login component',
agent: 'claudeCode:claude-opus-4-5',
repositories: [
'https://github.com/org/repo',
'https://gitlab.com/org/repo-2',
],
targetBranch: 'dev',
branchName: "cooper-is-awesome",
});
console.log(session.id);curl --request POST \
--url https://api.tembo.io/session/create \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Fix the authentication bug in the login component",
"description": "Users are reporting they cannot log in. JWT token validation appears to be failing.",
"agent": "claudeCode:claude-opus-4-5",
"repositories": [
"https://github.com/org/repo",
"https://gitlab.com/org/repo-2"
],
"codeRepoIds": [
"cbad4334-c844-4fef-a8da-d08f209f267e",
"6307d53a-b99d-4e90-ab89-f29114f33d53"
],
"targetBranch": "main",
"branchName": "feature/auth-fix",
"queueRightAway": false
}
'import requests
url = "https://api.tembo.io/session/create"
payload = {
"prompt": "Fix the authentication bug in the login component",
"description": "Users are reporting they cannot log in. JWT token validation appears to be failing.",
"agent": "claudeCode:claude-opus-4-5",
"repositories": ["https://github.com/org/repo", "https://gitlab.com/org/repo-2"],
"codeRepoIds": ["cbad4334-c844-4fef-a8da-d08f209f267e", "6307d53a-b99d-4e90-ab89-f29114f33d53"],
"targetBranch": "main",
"branchName": "feature/auth-fix",
"queueRightAway": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tembo.io/session/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => 'Fix the authentication bug in the login component',
'description' => 'Users are reporting they cannot log in. JWT token validation appears to be failing.',
'agent' => 'claudeCode:claude-opus-4-5',
'repositories' => [
'https://github.com/org/repo',
'https://gitlab.com/org/repo-2'
],
'codeRepoIds' => [
'cbad4334-c844-4fef-a8da-d08f209f267e',
'6307d53a-b99d-4e90-ab89-f29114f33d53'
],
'targetBranch' => 'main',
'branchName' => 'feature/auth-fix',
'queueRightAway' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tembo.io/session/create"
payload := strings.NewReader("{\n \"prompt\": \"Fix the authentication bug in the login component\",\n \"description\": \"Users are reporting they cannot log in. JWT token validation appears to be failing.\",\n \"agent\": \"claudeCode:claude-opus-4-5\",\n \"repositories\": [\n \"https://github.com/org/repo\",\n \"https://gitlab.com/org/repo-2\"\n ],\n \"codeRepoIds\": [\n \"cbad4334-c844-4fef-a8da-d08f209f267e\",\n \"6307d53a-b99d-4e90-ab89-f29114f33d53\"\n ],\n \"targetBranch\": \"main\",\n \"branchName\": \"feature/auth-fix\",\n \"queueRightAway\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tembo.io/session/create")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"Fix the authentication bug in the login component\",\n \"description\": \"Users are reporting they cannot log in. JWT token validation appears to be failing.\",\n \"agent\": \"claudeCode:claude-opus-4-5\",\n \"repositories\": [\n \"https://github.com/org/repo\",\n \"https://gitlab.com/org/repo-2\"\n ],\n \"codeRepoIds\": [\n \"cbad4334-c844-4fef-a8da-d08f209f267e\",\n \"6307d53a-b99d-4e90-ab89-f29114f33d53\"\n ],\n \"targetBranch\": \"main\",\n \"branchName\": \"feature/auth-fix\",\n \"queueRightAway\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tembo.io/session/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"Fix the authentication bug in the login component\",\n \"description\": \"Users are reporting they cannot log in. JWT token validation appears to be failing.\",\n \"agent\": \"claudeCode:claude-opus-4-5\",\n \"repositories\": [\n \"https://github.com/org/repo\",\n \"https://gitlab.com/org/repo-2\"\n ],\n \"codeRepoIds\": [\n \"cbad4334-c844-4fef-a8da-d08f209f267e\",\n \"6307d53a-b99d-4e90-ab89-f29114f33d53\"\n ],\n \"targetBranch\": \"main\",\n \"branchName\": \"feature/auth-fix\",\n \"queueRightAway\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"description": "<string>",
"status": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"htmlUrl": "https://app.tembo.io/sessions/123e4567-e89b-12d3-a456-426614174000"
}{
"error": "<string>"
}{
"error": "<string>"
}