Skip to main content
Every public type is exported from the package root: import type { ... } from '@personaai/sdk'. There’s no separate @personaai/sdk/types entry point — one import covers the client, every resource, and every type. This page documents all of them.

Full export index

This table is generated from the SDK’s actual exports (v0.4.1) — nothing here is invented.

Configuration types

PersonaClientOptions (= HttpClientOptions)

RequestOptions

Principal context

ProjectMachineContext

Resolved from a bare Project credential — acting as the Project itself.

ProjectRuntimeContext

Resolved from a Project credential paired with x-persona-external-user-id (i.e. externalUserId was set on the client).

PrincipalContext

ProjectMachineContext | ProjectRuntimeContext — the return type of client.whoami().

Shared result types

PaginationInfo

PaginatedResult<T>

Returned by every paginated list()/discover() — Agents, Skills, Knowledge, MCPs, Threads, Stores, Files, Audit Logs. Not Providers (bare Provider[]) or Memory (MemoryListResult).

BulkDeleteResult

Returned by every bulkDelete(ids).

ResourceUsage

Returned by every getUsage(id).

Provider types

Provider

A Provider as returned by the API — apiKey is never included.

CreateProviderInput

UpdateProviderInput

All fields optional (label?, baseURL?, apiKey?, defaultModel?, isDefault?) — only what you pass is changed. apiKey replaces the stored key entirely; omit to leave it untouched.

ProviderModel

{ id: string } — a model id reported available by a Provider’s endpoint.

ProviderTestConnectionResult

{ success: boolean; message: string } — success: false means the endpoint rejected the credentials/URL (a result, not a thrown error).

Skill types

Skill

Raw Mongo shape — _id, not id.

SkillFile

CreateSkillInput

name (req), description (req), instructions (req), isPublic? (default false), files? ({ path, content, mimeType? }[]).

UpdateSkillInput

All optional: name?, description?, instructions?, isPublic?, files? — files replaces the entire array (not a merge/append).

DiscoverSkillsParams

page? (default 1), limit? (default 20), search? (free-text vs name/description), scope?: 'mine' (restricts to the asserted external user’s own Skills — ProjectRuntimeContext only).

Agent types

Agent

Raw Mongo shape — _id, not id.
skills/mcps/knowledgeBases/storeMounts are typed unknown[] deliberately — the wire shape is genuinely different per call: bare id strings on create()/update()/list(), populated objects on get(). The SDK reflects that real difference rather than picking one shape and being wrong for the other calls.
{ website?: string; twitter?: string; github?: string; linkedin?: string } — all optional.

AgentVisibility

'private' | 'unlisted' | 'public' — unlisted is reachable by direct link/id but excluded from public discovery listings.

AgentCategory

'productivity' | 'coding' | 'creative' | 'research' | 'roleplay' | 'other'.

CreateAgentInput

Required: name, systemPrompt, providerId. Optional (with defaults where noted): description?, avatar?, tags?, tagline?, bio?, personalityTraits?, socialLinks?, modelName?, webSearchEnabled? (default false), visibility? (default 'private'), category? (default 'other'), skills?: string[], mcps?: string[], knowledgeBases?: string[], storeMounts?: string[], interruptOn?: Record<string, boolean>, isActive? (default true). See Agents.

UpdateAgentInput

All fields optional. Array/map fields replace entirely: skills?, mcps?, knowledgeBases?, storeMounts?, interruptOn? — not merges/appends.

DiscoverAgentsParams

page? (default 1), limit? (default 20), search? (free-text vs name/description/tagline), category?: AgentCategory, scope?: 'mine'.

McpConnection

Returned by agents.getMcpConnections(agentId) — one entry per authType: 'oauth', authMode: 'user' MCP attached to the Agent, and whether the calling identity (the client’s asserted external user) has connected it yet.

Knowledge types

KnowledgeBase

Raw Mongo shape — _id, not id.

KnowledgeDocument

{ fileName: string; fileSize: number; mimeType: string; chunkCount: number; uploadedAt: string }.

CreateKnowledgeBaseInput

Required: name, providerId. Optional: description?, isPublic? (default false), embeddingModel? (default 'text-embedding-3-small'), chunkSize? (default 800), chunkOverlap? (default 100), topK? (default 5).

UpdateKnowledgeBaseInput

All optional. Does not retroactively re-embed existing documents when providerId/embeddingModel/chunkSize/chunkOverlap change.

DiscoverKnowledgeBasesParams

page?, limit?, search?, scope?: 'mine' — same semantics as DiscoverSkillsParams.

UploadFileInput

UploadDocumentsResult

DeleteDocumentResult

{ removedChunks: number; remainingDocuments: number; remainingChunks: number }.

KnowledgeSearchResult

MCP types

McpTransport

'http' | 'sse'.

McpAuthType

'none' | 'oauth' | 'apiKey'.

McpAuthMode

'owner' | 'user' — owner: one shared connection for the whole Project; user: each external user connects their own.

Mcp

Raw Mongo shape — _id, not id. Secrets are stripped: oauth/apiKeyEncrypted are replaced with hasApiKey/a summarized oauth object.

McpTool

{ name: string; description: string }.

McpResourceSummary

{ uri: string; name: string; description: string; mimeType: string }.

McpResourceTemplate

{ uriTemplate: string; name: string; description: string; mimeType: string; toolName: string } — a resource whose uri has placeholder params to fill before calling readResource().

McpOAuthConfig

McpOAuthInput

{ clientId: string; clientSecret: string; scopes?: string[] }.

CreateMcpInput

Required: name, transport, url. Optional: description?, authType? (default 'none'), authMode? (default 'owner'), oauth? (required when authType: 'oauth' and useDynamicRegistration isn’t set), apiKey? (required when authType: 'apiKey'), useDynamicRegistration? (default false), isEnabled? (default true).

UpdateMcpInput

All optional: name?, description?, transport?, url?, authType?, authMode?, isEnabled?, useDynamicRegistration?, oauth?: Partial<McpOAuthInput>, apiKey? (replaces the stored key entirely; omit to leave it untouched).

DiscoverMcpsParams

page?, limit?, search?, scope?: 'mine' — same semantics as DiscoverSkillsParams.

McpTestConnectionResult

{ tools: McpTool[]; resources: McpResourceSummary[]; resourceTemplates: McpResourceTemplate[] }.

McpReadResourceResult

{ text: string; mimeType: string }.

McpUserConnectionStatus

{ connected: boolean } — whether the asserted external user has completed their per-user OAuth connection.

Thread types

Thread

Raw Mongo shape — _id, not id.

CreateThreadInput

{ agentId: string }.

UpdateThreadInput

{ title?: string; isArchived?: boolean } — all optional, only what you pass is changed.

ListThreadsParams

{ page?: number; limit?: number } — defaults 1/20.

ThreadMessages

Memory types

MemoryFile

MemoryAgentGroup

{ agentId: string; agentName: string | null; files: MemoryFile[] } — agentName is null if the Agent no longer exists.

MemoryListResult

{ userFiles: MemoryFile[]; agentMemories: MemoryAgentGroup[] } — returned by memory.list().

MemoryFileScopeParams

{ scope?: 'user' | 'agent'; agentId?: string } — scope defaults to 'user'; agentId required when scope is 'agent'.

GetMemoryFileParams

MemoryFileScopeParams & { path: string }.

WriteMemoryFileInput

MemoryFileScopeParams & { path: string; content: string }.

DeleteMemoryFileParams

MemoryFileScopeParams & { path: string }.

Store types

StoreScope

'domain' | 'externalUser' — one shared namespace for the whole Project vs. one namespace per external user, resolved per Agent run. Immutable after creation.

StoreAccessMode

'readonly' | 'readwrite' — readonly blocks Agent tool writes (content populated only through this API); readwrite lets Agents also write via their own tools.

Store

CreateStoreInput

{ name: string (req); description?: string; scope: StoreScope (req); accessMode?: StoreAccessMode (default 'readwrite') }.

UpdateStoreInput

{ name?: string; description?: string; accessMode?: StoreAccessMode } — scope is deliberately not included — it’s immutable after creation.

DiscoverStoresParams

{ page?: number; limit?: number; search?: string } — search matches against name.

StoreFile

{ path: string; content: string; mimeType: string; createdAt: string; updatedAt: string }.

GetStoreFileParams / DeleteStoreFileParams

{ path: string }.

WriteStoreFileInput

{ path: string; content: string }.

File types

PersonaFile

Clean formatted shape — id, not _id.

UploadFilePayload

{ filename: string (req); content: Uint8Array | Blob (req); contentType?: string; agentId?: string; threadId?: string } — see UploadFileInput for the content rules.

ListFilesParams

{ page?: number; limit?: number } — defaults 1/20.

Audit log types

AuditLogEntry

ListAuditLogsParams

{ page?: number; limit?: number; eventType?: string } — eventType is an optional exact-match filter.

Chat types

AguiEvent

AGUIEvent from @ag-ui/core — the full discriminated union of every AG-UI protocol event this backend can emit. The SDK re-exports it (and EventType) so you don’t need a separate @ag-ui/core dependency. See Chat for the event-type table.

ChatMessageInput

{ role: 'user' | 'assistant'; content: string } — plain text only; the SDK doesn’t yet support multi-part/multimodal content on the way in.

ChatResume

The shape you pass must match the pending interrupt’s kind (see ChatInterrupt).

SendMessageOptions

ChatInterrupt

ChatResult

ArchitectMessageOptions

{ messages: ChatMessageInput[] (req); resume?: ChatResume; signal?: AbortSignal } — see Architect.

AG-UI custom event payload types

These mirror the Zod schemas served machine-readably at GET /api/v1/developer/agui/schema.

AGUI_SCHEMA_VERSION

'1.0.0' — the schema document version this SDK release was written against.

ClarificationQuestion

{ id: string; text: string; options: string[]; required: boolean; allowCustom: boolean }.

ClarificationRequestPayload

{ questions: ClarificationQuestion[]; currentIndex: number } — payload of the CUSTOM clarification_request event (pauses the run pending answers).

HitlRequestPayload

{ actionRequests: unknown[]; reviewConfigs: unknown[] } — payload of the CUSTOM hitl_request event (pauses the run pending approval of pending tool calls). The two fields are opaque langchain humanInTheLoopMiddleware structures, passed through as-is by the backend.

McpAppPayload

{ toolCallId: string; resourceUri: string; mcpId: string } — payload of the CUSTOM mcp_app event: an MCP-registered tool call declared an interactive widget via _meta.ui.resourceUri.

SubagentActivityPayload

A discriminated union — payload of the CUSTOM subagent_activity event (a nested deepagents task tool invocation’s activity):

RunErrorCode

'PROVIDER_AUTH_ERROR' | 'PROVIDER_RATE_LIMIT' | 'TOOL_TIMEOUT' | 'TOOL_ERROR' | 'CONTEXT_LENGTH_EXCEEDED' | 'INTERNAL_ERROR' — the code values a RUN_ERROR event’s code field is drawn from.

PersonaRunErrorEvent

Undocumented-by-design

  • errorFromResponse() and parseAguiEventStream() are internal helpers — not exported from the package root; don’t rely on them.
  • The PersonaClient.http property is private — use a standalone HttpClient for unwrapped endpoints (see HttpClient).