@polpo-ai/client package provides a typed HTTP client, SSE streaming, and reactive store for interacting with the Polpo API from any TypeScript/JavaScript environment — Node.js, Deno, Bun, browser, or edge runtimes.
This is the framework-agnostic foundation. For React hooks, see
@polpo-ai/react which builds on top of this package.Installation
Quick Start
PolpoClient
The main HTTP client class. All methods return typed promises.Tasks
| Method | Returns | Description |
|---|---|---|
getTasks(filters?) | Task[] | List tasks with optional status/group/agent filters |
getTask(id) | Task | Get a single task |
createTask(opts) | Task | Create a new task |
updateTask(id, opts) | Task | Update a task |
deleteTask(id) | void | Delete a task |
retryTask(id) | void | Retry a failed task |
killTask(id) | void | Kill a running task’s agent |
reassessTask(id) | void | Re-run assessment on a task |
queueTask(id) | void | Queue a task for execution |
Missions
| Method | Returns | Description |
|---|---|---|
getMissions() | Mission[] | List all missions |
getMission(id) | Mission | Get a single mission |
createMission(opts) | Mission | Create a new mission |
updateMission(id, opts) | Mission | Update mission metadata |
deleteMission(id) | void | Delete a mission |
executeMission(id) | ExecuteMissionResult | Execute a draft mission |
resumeMission(id, opts?) | ResumeMissionResult | Resume a failed/paused mission |
abortMission(id) | { aborted: number } | Abort an active mission |
Agents
| Method | Returns | Description |
|---|---|---|
getAgents() | AgentConfig[] | List all agents |
getAgent(name) | AgentConfig | Get a single agent |
addAgent(opts) | void | Register a new agent |
removeAgent(name) | void | Remove an agent |
getProcesses() | AgentProcess[] | List active agent processes |
Chat
| Method | Returns | Description |
|---|---|---|
chatCompletion(opts) | ChatCompletionResponse | Non-streaming chat completion |
streamChatCompletion(opts) | ChatCompletionStream | Streaming chat (async iterable) |
getSessions() | ChatSession[] | List chat sessions |
getSessionMessages(id) | ChatMessage[] | Get messages for a session |
Other
| Method | Returns | Description |
|---|---|---|
getPlaybooks() | PlaybookInfo[] | List available playbooks |
runPlaybook(name, params?) | PlaybookRunResult | Execute a playbook |
getSkills() | SkillWithAssignment[] | List skills |
getApprovals(status?) | ApprovalRequest[] | List approval requests |
approve(id, opts?) | void | Approve a request |
reject(id, feedback) | void | Reject a request |
getNotifications(opts?) | NotificationRecord[] | List notifications |
getMemory() | { exists, content } | Get project memory |
updateMemory(content) | void | Update project memory |
getAuthStatus() | AuthStatusResponse | Per-provider auth health |
ChatCompletionStream
Async iterable for streaming chat completions:EventSourceManager
SSE connection manager with auto-reconnect:EventSource is a browser API. In Node.js, use a polyfill like eventsource or use the PolpoStore approach below for a higher-level API.PolpoStore
A framework-agnostic reactive store that consumes SSE events and maintains application state:Store API
| Method | Description |
|---|---|
subscribe(listener) | Subscribe to state changes. Returns unsubscribe function. |
getSnapshot() | Get current state |
setTasks(tasks) | Bulk-set tasks (deduplicates) |
setMissions(missions) | Bulk-set missions |
setAgents(agents) | Bulk-set agents |
setProcesses(processes) | Bulk-set processes |
applyEvent(event) | Apply a single SSE event |
applyEventBatch(events) | Apply multiple SSE events atomically |