notionagents

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 15 Imported by: 0

README

Notion Agents SDK for Go

A Go client for interacting with Notion Agents via the Notion Agents API.

Disclaimer: This is an unofficial, community-maintained SDK and is not affiliated with or endorsed by Notion. It is maintained on a best-effort basis.

Status: Alpha

Notion Agents API reference: developers.notion.com/reference/internal/list-agents

This SDK is a lightweight, idiomatic Go client built entirely on the standard library (net/http, encoding/json). Zero external dependencies.

Contents

Requirements

  • Go 1.23+ (uses iter package for pagination iterators)
  • A Notion API token (internal integration secret or OAuth access token)
  • Alpha access & Custom Agents access

Installation

go get github.com/brittonhayes/notion-agent-sdk-go
Environment variables

Most examples assume your token is set as:

export NOTION_API_TOKEN="secret_..."

Quickstart (async)

The async flow returns immediately with a thread_id, then you poll for completion and fetch messages separately.

package main

import (
    "context"
    "fmt"
    "log"

    notionagents "github.com/brittonhayes/notion-agent-sdk-go"
)

func main() {
    client := notionagents.NewClient(notionagents.ClientOptions{
        Auth: "secret_...",
    })
    ctx := context.Background()

    // Pick an agent
    agents, err := client.Agents.List(ctx, &notionagents.AgentListParams{PageSize: 10})
    if err != nil {
        log.Fatal(err)
    }
    agent := client.Agents.Agent(agents.Results[0].ID)

    // Start a conversation (returns quickly with pending status)
    invocation, err := agent.Chat(ctx, notionagents.ChatParams{Message: "Hello!"})
    if err != nil {
        log.Fatal(err)
    }

    // Poll until the thread is completed or failed
    thread := agent.Thread(invocation.ThreadID)
    threadInfo, err := thread.Poll(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Thread status: %s\n", threadInfo.Status)

    // Fetch messages
    verbose := true
    messages, err := thread.ListMessages(ctx, &notionagents.ThreadMessageListParams{
        PageSize: 50,
        Verbose:  &verbose,
    })
    if err != nil {
        log.Fatal(err)
    }
    for _, msg := range messages.Results {
        fmt.Printf("%s: %s\n", msg.Role, msg.Content)
    }
}

Quickstart (streaming)

The streaming flow uses newline-delimited JSON (NDJSON) under the hood. The SDK exposes it via a StreamReader iterator or channel-based API.

StreamReader (iterator)
agent := client.Agents.Personal()

reader, err := agent.Stream(ctx, notionagents.ChatStreamParams{
    Message: "Summarize my week",
})
if err != nil {
    log.Fatal(err)
}
defer reader.Close()

for {
    chunk, err := reader.Next()
    if err == io.EOF {
        break
    }
    if err != nil {
        log.Fatal(err)
    }

    if chunk.Type == "message" && chunk.Role == "agent" {
        fmt.Print(notionagents.StripLangTags(chunk.Content))
    }
}

// Access accumulated thread info after stream completes
info := reader.ThreadInfo()
fmt.Printf("\nThread: %s (%d messages)\n", info.ThreadID, len(info.Messages))
Channels
chunks, info, errc := agent.ChatStream(ctx, notionagents.ChatStreamParams{
    Message: "Hello",
})

for chunk := range chunks {
    if chunk.Type == "message" && chunk.Role == "agent" {
        fmt.Print(chunk.Content)
    }
}

// Check for errors
if err := <-errc; err != nil {
    log.Fatal(err)
}

// Get final thread info
if threadInfo := <-info; threadInfo != nil {
    fmt.Printf("\nThread: %s\n", threadInfo.ThreadID)
}

Concepts

Agents: custom vs personal
  • Custom agents are user-created agents in a workspace. They appear in client.Agents.List().
  • The personal agent is Notion AI, addressed by a reserved UUID:
    • Use client.Agents.Personal(), or client.Agents.Agent(notionagents.PersonalAgentID).
    • Note: internal integrations can't access the personal agent, since internal integrations are generally owned by workspace owners rather than any specific user. The personal agent won't appear in client.Agents.List(), and requests targeting it will fail with object_not_found.
Threads and messages

A chat happens inside a thread:

  • agent.Chat() creates/continues a thread and returns ChatInvocationResponse{ThreadID, Status: "pending"}.
  • thread.Poll() checks the thread until it is completed or failed, using exponential backoff with jitter.
  • thread.ListMessages() fetches messages from GET /threads/:thread_id/messages.

Polling returns thread metadata (status/title/creator/version). Messages are fetched separately via ListMessages().

Verbose output: content_parts

When available, agent messages include a structured representation in ContentParts.

  • Streaming: agent.Stream() includes content_parts by default. Pass Verbose: boolPtr(false) to omit.
  • Message listing: thread.ListMessages(&ThreadMessageListParams{Verbose: boolPtr(true)}) includes content_parts.

Part types you may encounter:

  • text - model text output
  • thinking - model reasoning
  • tool_call - tool invocation with optional results
  • follow_ups - suggested follow-up actions
  • custom_agent_template_picker - non-text UI state

If you don't need this level of detail, set Verbose to false and use Content only.

API reference

Full documentation is available via go doc:

go doc github.com/brittonhayes/notion-agent-sdk-go
Exports
Export Description
NewClient Create a new API client
PersonalAgentID Reserved UUID for the personal agent
StripLangTags Remove <lang ...> tags from agent output
IsPersonalAgent Check if an ID is the personal agent
IterAgents / CollectAgents Auto-paginating agent iterators
IterThreads / CollectThreads Auto-paginating thread iterators
IterMessages / CollectMessages Auto-paginating message iterators
Client
client := notionagents.NewClient(notionagents.ClientOptions{
    Auth:          "secret_...",    // required
    BaseURL:       "",              // defaults to "https://api.notion.com"
    NotionVersion: "",              // defaults to "2025-09-03"
    HTTPClient:    nil,             // defaults to http.DefaultClient
})
client.Agents (AgentOperations)
// List all accessible agents
resp, err := client.Agents.List(ctx, &notionagents.AgentListParams{
    Name:        "",    // filter by name
    PageSize:    10,
    StartCursor: "",
})

// Get an agent handle by ID
agent := client.Agents.Agent(agentID)

// Get the personal agent handle
personal := client.Agents.Personal()
Agent
// Async chat
resp, err := agent.Chat(ctx, notionagents.ChatParams{
    Message:     "Hello!",
    ThreadID:    "",                        // optional: continue existing thread
    Attachments: []ChatAttachmentInput{},   // optional: file attachments
})

// Streaming chat (iterator)
reader, err := agent.Stream(ctx, notionagents.ChatStreamParams{
    Message:  "Hello!",
    ThreadID: "",
    Verbose:  nil,  // default true
    OnMessage: func(msg notionagents.StreamMessage) {
        // called on each message upsert
    },
})

// Streaming chat (channels)
chunks, info, errc := agent.ChatStream(ctx, params)

// Thread operations
thread := agent.Thread(threadID)
item, err := agent.GetThread(ctx, threadID)
item, err := agent.PollThread(ctx, threadID, nil)
resp, err := agent.ListThreads(ctx, &notionagents.ThreadListParams{...})
Thread
// Get thread metadata
item, err := thread.Get(ctx)

// Poll until completed/failed with exponential backoff
item, err := thread.Poll(ctx, &notionagents.PollThreadOptions{
    MaxAttempts:    60,     // default
    BaseDelayMs:   1000,   // default
    MaxDelayMs:    10000,  // default
    InitialDelayMs: 1000,  // default
    OnPending:      func(t notionagents.ThreadListItem, attempt int) {},
    OnThreadNotFound: func(attempt int) {},
})

// List messages
resp, err := thread.ListMessages(ctx, &notionagents.ThreadMessageListParams{
    Verbose:     nil,       // default true
    Role:        "agent",   // "user" or "agent"
    PageSize:    50,
    StartCursor: "",
})
Pagination helpers

The SDK provides Go 1.23 iterators that automatically handle cursor-based pagination:

// Iterate over all agents
for agent, err := range notionagents.IterAgents(ctx, client, nil) {
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(agent.Name)
}

// Or collect all into a slice
agents, err := notionagents.CollectAgents(ctx, client, nil)
threads, err := notionagents.CollectThreads(ctx, agent, nil)
messages, err := notionagents.CollectMessages(ctx, thread, nil)

Errors

The SDK provides typed errors for common scenarios:

var agentErr *notionagents.AgentNotFoundError
var threadErr *notionagents.ThreadNotFoundError
var pollErr *notionagents.PollingTimeoutError
var streamErr *notionagents.StreamError

if errors.As(err, &agentErr) {
    fmt.Printf("Agent not found: %s\n", agentErr.AgentID)
}
Error Description
NotionAgentsError Base error with Code and Msg fields
AgentNotFoundError Agent is missing or inaccessible
ThreadNotFoundError Thread cannot be found
PollingTimeoutError Poll() exceeded max attempts
StreamError Streaming failure (HTTP error, malformed response, etc.)

Streaming can also produce error chunks (chunk.Type == "error") with a machine-readable Code and Message; handle both patterns.

Examples

See examples/cli/ for a complete interactive CLI tool that demonstrates:

  • Client initialization from environment variables
  • Listing and selecting agents
  • Streaming chat with real-time output
  • Thread continuity across messages
  • Signal handling with context

To run:

export NOTION_API_TOKEN="secret_..."
cd examples/cli
go run .

License

This project is licensed under the MIT License. See LICENSE for details.

Documentation

Overview

Package notionagents provides a Go client for the Notion Agents API.

This SDK allows you to list agents, create and manage chat threads, and stream real-time responses from Notion Agents. It is built entirely on the Go standard library with zero external dependencies.

Getting started

Create a client with your Notion API token:

client := notionagents.NewClient(notionagents.ClientOptions{
    Auth: "secret_...",
})

Async chat

Start a chat, poll for completion, then fetch messages:

resp, _ := client.Agents.Agent(agentID).Chat(ctx, notionagents.ChatParams{
    Message: "Hello!",
})
thread := client.Agents.Agent(agentID).Thread(resp.ThreadID)
thread.Poll(ctx, nil)
messages, _ := thread.ListMessages(ctx, nil)

Streaming chat

Stream responses in real time using the iterator-style StreamReader:

reader, _ := agent.Stream(ctx, notionagents.ChatStreamParams{
    Message: "Summarize my week",
})
defer reader.Close()
for {
    chunk, err := reader.Next()
    if err == io.EOF {
        break
    }
    // handle chunk
}

Or use the channel-based Agent.ChatStream for concurrent consumption.

Pagination

Auto-paginating iterators use Go 1.23 iter.Seq2:

for agent, err := range notionagents.IterAgents(ctx, client, nil) {
    // ...
}

Index

Constants

View Source
const (
	// PersonalAgentID is the reserved UUID for the personal agent (Notion AI).
	PersonalAgentID = "33333333-3333-3333-3333-333333333333"

	// DefaultBaseURL is the default Notion API base URL.
	DefaultBaseURL = "https://api.notion.com"

	// DefaultVersion is the default Notion API version.
	DefaultVersion = "2025-09-03"
)

Variables

This section is empty.

Functions

func IsPersonalAgent

func IsPersonalAgent(agentID string) bool

IsPersonalAgent returns true if the given agent ID is the personal agent.

func IterAgents

func IterAgents(ctx context.Context, client *Client, params *AgentListParams) iter.Seq2[AgentData, error]

IterAgents returns an iterator over all agents, automatically handling pagination.

func IterMessages

func IterMessages(ctx context.Context, thread *Thread, params *ThreadMessageListParams) iter.Seq2[ThreadMessageItem, error]

IterMessages returns an iterator over all messages in a thread.

func IterThreads

func IterThreads(ctx context.Context, agent *Agent, params *ThreadListParams) iter.Seq2[ThreadListItem, error]

IterThreads returns an iterator over all threads for an agent.

func StripLangTags

func StripLangTags(text string) string

StripLangTags removes <lang ...> XML tags from text.

Types

type Agent

type Agent struct {
	ID          string
	Name        string
	Instruction *string
	// contains filtered or unexported fields
}

Agent provides operations on a specific agent.

func (*Agent) Chat

func (a *Agent) Chat(ctx context.Context, params ChatParams) (*ChatInvocationResponse, error)

Chat starts an async chat with the agent.

func (*Agent) ChatStream

func (a *Agent) ChatStream(ctx context.Context, params ChatStreamParams) (<-chan StreamChunk, <-chan *ThreadInfo, <-chan error)

ChatStream opens a streaming chat and returns channels for chunks, thread info, and errors.

func (*Agent) GetThread

func (a *Agent) GetThread(ctx context.Context, threadID string) (*ThreadListItem, error)

GetThread retrieves a specific thread.

func (*Agent) ListThreads

func (a *Agent) ListThreads(ctx context.Context, params *ThreadListParams) (*ThreadListResponse, error)

ListThreads returns a paginated list of threads for this agent.

func (*Agent) PollThread

func (a *Agent) PollThread(ctx context.Context, threadID string, opts *PollThreadOptions) (*ThreadListItem, error)

PollThread polls a thread until it completes or fails, using exponential backoff.

func (*Agent) Stream

func (a *Agent) Stream(ctx context.Context, params ChatStreamParams) (*StreamReader, error)

Stream opens a streaming chat connection and returns a StreamReader.

func (*Agent) Thread

func (a *Agent) Thread(threadID string) *Thread

Thread returns a Thread handle.

type AgentContentPart

type AgentContentPart struct {
	Type       string       `json:"type"`
	Text       string       `json:"text,omitempty"`
	ToolCallID *string      `json:"tool_call_id,omitempty"`
	ToolName   string       `json:"tool_name,omitempty"`
	Input      string       `json:"input,omitempty"`
	Results    []ToolResult `json:"results,omitempty"`
	FollowUps  []FollowUp   `json:"follow_ups,omitempty"`
}

AgentContentPart represents a structured part of agent message content.

type AgentData

type AgentData struct {
	Object             string        `json:"object"`
	ID                 string        `json:"id"`
	Name               string        `json:"name"`
	Description        *string       `json:"description"`
	Instruction        *string       `json:"instruction"`
	InstructionsPageID *string       `json:"instructions_page_id"`
	Icon               *AgentIcon    `json:"icon"`
	Version            *AgentVersion `json:"version"`
}

AgentData represents an agent returned by the API.

func CollectAgents

func CollectAgents(ctx context.Context, client *Client, params *AgentListParams) ([]AgentData, error)

CollectAgents collects all agents into a slice.

type AgentIcon

type AgentIcon struct {
	Type              string             `json:"type"`
	Emoji             *string            `json:"emoji,omitempty"`
	File              *FileURL           `json:"file,omitempty"`
	External          *ExternalURL       `json:"external,omitempty"`
	CustomEmoji       *CustomEmoji       `json:"custom_emoji,omitempty"`
	CustomAgentAvatar *CustomAgentAvatar `json:"custom_agent_avatar,omitempty"`
}

AgentIcon represents an agent's icon, which can be of several types.

type AgentListParams

type AgentListParams struct {
	Name        string
	PageSize    int
	StartCursor string
}

AgentListParams configures agent listing requests.

type AgentListResponse

type AgentListResponse struct {
	Object     string      `json:"object"`
	Type       string      `json:"type"`
	Results    []AgentData `json:"results"`
	HasMore    bool        `json:"has_more"`
	NextCursor *string     `json:"next_cursor"`
}

AgentListResponse is the paginated response for listing agents.

type AgentNotFoundError

type AgentNotFoundError struct {
	AgentID string
}

AgentNotFoundError is returned when an agent cannot be found.

func (*AgentNotFoundError) Error

func (e *AgentNotFoundError) Error() string

type AgentOperations

type AgentOperations struct {
	// contains filtered or unexported fields
}

AgentOperations provides operations on agents.

func (*AgentOperations) Agent

func (a *AgentOperations) Agent(agentID string) *Agent

Agent returns an Agent handle for the given agent ID.

func (*AgentOperations) List

List returns a paginated list of agents.

func (*AgentOperations) Personal

func (a *AgentOperations) Personal() *Agent

Personal returns an Agent handle for the personal agent.

type AgentVersion

type AgentVersion struct {
	ID          string `json:"id"`
	Number      int    `json:"number"`
	PublishedAt string `json:"published_at"`
}

AgentVersion contains version information for an agent.

type ChatAttachmentInput

type ChatAttachmentInput struct {
	FileUploadID string `json:"file_upload_id"`
	Name         string `json:"name,omitempty"`
}

ChatAttachmentInput is used to attach files when sending a chat message.

type ChatInvocationResponse

type ChatInvocationResponse struct {
	Object   string `json:"object"`
	AgentID  string `json:"agent_id"`
	ThreadID string `json:"thread_id"`
	Status   string `json:"status"`
}

ChatInvocationResponse is returned when starting an async chat.

type ChatParams

type ChatParams struct {
	Message     string
	Attachments []ChatAttachmentInput
	ThreadID    string
}

ChatParams configures a chat request.

type ChatStreamParams

type ChatStreamParams struct {
	Message     string
	Attachments []ChatAttachmentInput
	ThreadID    string
	Verbose     *bool
	OnMessage   func(message StreamMessage)
}

ChatStreamParams configures a streaming chat request.

type Client

type Client struct {
	Agents *AgentOperations
	// contains filtered or unexported fields
}

Client is the Notion Agents API client.

func NewClient

func NewClient(opts ClientOptions) *Client

NewClient creates a new Notion Agents client.

type ClientOptions

type ClientOptions struct {
	Auth          string       // Required: Notion API token
	BaseURL       string       // Optional: defaults to DefaultBaseURL
	NotionVersion string       // Optional: defaults to DefaultVersion
	HTTPClient    *http.Client // Optional: custom HTTP client
}

ClientOptions configures a new Client.

type CreatedBy

type CreatedBy struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

CreatedBy identifies who created a thread.

type CustomAgentAvatar

type CustomAgentAvatar struct {
	URL string `json:"url"`
}

type CustomEmoji

type CustomEmoji struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

type ExternalURL

type ExternalURL struct {
	URL string `json:"url"`
}

type FileURL

type FileURL struct {
	URL        string `json:"url"`
	ExpiryTime string `json:"expiry_time,omitempty"`
}

type FollowUp

type FollowUp struct {
	Label   string `json:"label"`
	Message string `json:"message"`
}

FollowUp represents a suggested follow-up action.

type MessageParent

type MessageParent struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

MessageParent identifies the parent of a message.

type NotionAgentsError

type NotionAgentsError struct {
	Msg  string
	Code string
}

NotionAgentsError is the base error type for SDK errors.

func (*NotionAgentsError) Error

func (e *NotionAgentsError) Error() string

type PollThreadOptions

type PollThreadOptions struct {
	MaxAttempts      int
	BaseDelayMs      int
	MaxDelayMs       int
	InitialDelayMs   int
	OnPending        func(thread ThreadListItem, attempt int)
	OnThreadNotFound func(attempt int)
}

PollThreadOptions configures thread polling behavior.

type PollingTimeoutError

type PollingTimeoutError struct {
	Attempts int
}

PollingTimeoutError is returned when thread polling exceeds max attempts.

func (*PollingTimeoutError) Error

func (e *PollingTimeoutError) Error() string

type StreamChunk

type StreamChunk struct {
	Type         string                    `json:"type"`
	ThreadID     string                    `json:"thread_id,omitempty"`
	AgentID      string                    `json:"agent_id,omitempty"`
	ID           string                    `json:"id,omitempty"`
	Role         string                    `json:"role,omitempty"`
	Content      string                    `json:"content,omitempty"`
	Attachments  []ThreadMessageAttachment `json:"attachments,omitempty"`
	ContentParts []AgentContentPart        `json:"content_parts,omitempty"`
	Code         string                    `json:"code,omitempty"`
	Message      string                    `json:"message,omitempty"`
}

StreamChunk represents a single chunk from a streaming chat response.

type StreamError

type StreamError struct {
	Msg  string
	Code string
}

StreamError is returned for streaming-related errors.

func (*StreamError) Error

func (e *StreamError) Error() string

type StreamMessage

type StreamMessage struct {
	ID           string                    `json:"id"`
	Role         string                    `json:"role"`
	Content      string                    `json:"content"`
	Attachments  []ThreadMessageAttachment `json:"attachments,omitempty"`
	ContentParts []AgentContentPart        `json:"content_parts,omitempty"`
}

StreamMessage represents an accumulated message from a stream.

type StreamReader

type StreamReader struct {
	// contains filtered or unexported fields
}

StreamReader reads streaming chat responses using an iterator pattern.

func (*StreamReader) Close

func (r *StreamReader) Close() error

Close closes the underlying response body.

func (*StreamReader) Next

func (r *StreamReader) Next() (StreamChunk, error)

Next returns the next chunk from the stream. Returns io.EOF when the stream is complete.

func (*StreamReader) ThreadInfo

func (r *StreamReader) ThreadInfo() *ThreadInfo

ThreadInfo returns the accumulated thread info after the stream completes.

type Thread

type Thread struct {
	ThreadID string
	AgentID  string
	// contains filtered or unexported fields
}

Thread provides operations on a specific thread.

func (*Thread) Get

func (t *Thread) Get(ctx context.Context) (*ThreadListItem, error)

Get retrieves this thread's details.

func (*Thread) ListMessages

ListMessages returns a paginated list of messages in this thread.

func (*Thread) Poll

func (t *Thread) Poll(ctx context.Context, opts *PollThreadOptions) (*ThreadListItem, error)

Poll polls this thread until completion using exponential backoff.

type ThreadInfo

type ThreadInfo struct {
	ThreadID string
	AgentID  string
	Messages []StreamMessage
}

ThreadInfo contains the final result of a completed streaming chat.

type ThreadListItem

type ThreadListItem struct {
	Object       string        `json:"object"`
	ID           string        `json:"id"`
	Title        string        `json:"title"`
	Status       ThreadStatus  `json:"status"`
	CreatedBy    CreatedBy     `json:"created_by"`
	AgentVersion *AgentVersion `json:"agent_version"`
}

ThreadListItem represents a thread in list responses.

func CollectThreads

func CollectThreads(ctx context.Context, agent *Agent, params *ThreadListParams) ([]ThreadListItem, error)

CollectThreads collects all threads into a slice.

type ThreadListParams

type ThreadListParams struct {
	ID            string
	Title         string
	Status        ThreadStatus
	CreatedByType string
	CreatedByID   string
	StartCursor   string
	PageSize      int
}

ThreadListParams configures thread listing requests.

type ThreadListResponse

type ThreadListResponse struct {
	Object     string           `json:"object"`
	Type       string           `json:"type"`
	Results    []ThreadListItem `json:"results"`
	HasMore    bool             `json:"has_more"`
	NextCursor *string          `json:"next_cursor"`
}

ThreadListResponse is the paginated response for listing threads.

type ThreadMessageAttachment

type ThreadMessageAttachment struct {
	Name        string  `json:"name"`
	ContentType string  `json:"content_type"`
	URL         string  `json:"url"`
	ExpiryTime  *string `json:"expiry_time,omitempty"`
}

ThreadMessageAttachment represents a file attached to a message.

type ThreadMessageItem

type ThreadMessageItem struct {
	Object       string                    `json:"object"`
	ID           string                    `json:"id"`
	Role         string                    `json:"role"`
	Content      string                    `json:"content"`
	Parent       MessageParent             `json:"parent"`
	Attachments  []ThreadMessageAttachment `json:"attachments,omitempty"`
	ContentParts []AgentContentPart        `json:"content_parts,omitempty"`
}

ThreadMessageItem represents a message within a thread.

func CollectMessages

func CollectMessages(ctx context.Context, thread *Thread, params *ThreadMessageListParams) ([]ThreadMessageItem, error)

CollectMessages collects all messages into a slice.

type ThreadMessageListParams

type ThreadMessageListParams struct {
	Verbose     *bool
	Role        string
	PageSize    int
	StartCursor string
}

ThreadMessageListParams configures message listing requests.

type ThreadMessageListResponse

type ThreadMessageListResponse struct {
	Object     string              `json:"object"`
	Type       string              `json:"type"`
	Results    []ThreadMessageItem `json:"results"`
	HasMore    bool                `json:"has_more"`
	NextCursor *string             `json:"next_cursor"`
}

ThreadMessageListResponse is the paginated response for listing messages.

type ThreadNotFoundError

type ThreadNotFoundError struct {
	ThreadID string
}

ThreadNotFoundError is returned when a thread cannot be found.

func (*ThreadNotFoundError) Error

func (e *ThreadNotFoundError) Error() string

type ThreadStatus

type ThreadStatus string

ThreadStatus represents the status of a thread.

const (
	ThreadStatusPending   ThreadStatus = "pending"
	ThreadStatusCompleted ThreadStatus = "completed"
	ThreadStatusFailed    ThreadStatus = "failed"
)

type ToolResult

type ToolResult struct {
	ID          string      `json:"id"`
	AgentStepID *string     `json:"agent_step_id"`
	ToolCallID  *string     `json:"tool_call_id"`
	ToolName    string      `json:"tool_name"`
	ToolType    string      `json:"tool_type"`
	State       string      `json:"state"`
	Input       interface{} `json:"input"`
	Output      interface{} `json:"output"`
	Error       *string     `json:"error"`
	StartedAt   int64       `json:"started_at"`
	FinishedAt  *int64      `json:"finished_at"`
	DurationMs  *int64      `json:"duration_ms"`
}

ToolResult represents the result of an agent tool call.

Directories

Path Synopsis
Package testutil provides mock HTTP clients and response factories for testing code that uses the notionagents SDK.
Package testutil provides mock HTTP clients and response factories for testing code that uses the notionagents SDK.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL