tdsk-agent

Documents the architecture and APIs of a headless AI agent orchestration library.

Updated Jan 4, 2026
One-click install
npx skills add https://github.com/threadedstack/threadedstack --skill tdsk-agent-threadedstack
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tdsk-agent
Source: https://github.com/threadedstack/threadedstack/tree/main/.claude/skills/tdsk-agent
Command: npx skills add https://github.com/threadedstack/threadedstack --skill tdsk-agent-threadedstack

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers working with the @tdsk/agent library need a consolidated reference for its AgentRunner lifecycle, tool system, persistence interfaces, and integration points to build multi-turn AI agent applications without reading the entire codebase. ## Core Features & Use Cases - AgentRunner Lifecycle Reference: Covers init(), runTurn(), updateConfig(), and destroy() for instance-based sessions, plus the static AgentRunner.run() for one-shot SSE endpoints. - Tool System Documentation: Details 9 sandbox tools, 2 web tools via Jina, 2 memory tools backed by IMemoryProvider, and custom function tools from FunctionModel definitions. - Architecture Patterns: Explains event bridging to TStreamEvent, per-turn skill resolution, transient error retries with exponential backoff, and context window management with prune or compact strategies. - Use Case: When wiring a backend SSE endpoint to stream agent responses, consult this Skill to correctly implement IAgentRunnerDB persistence and the onExecuteFunction callback. ## Quick Start Ask the agent to explain how to initialize an AgentRunner instance with sandbox tools and run a multi-turn conversation.

Frequently Asked Questions about tdsk-agent

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a multi-turn AI agent session with AgentRunner?▼

Create an AgentRunner instance, call init() to set up the sandbox, tools, history, and pi-mono Agent, then call runTurn() for each user message. Use updateConfig() to hot-swap model or system prompt between turns, and destroy() to clean up.

How do I add custom function tools to a pi-mono agent?▼

Pass a FunctionModel array in TAgentInitOpts along with an onExecuteFunction callback. The buildCustomFunctionTools utility converts them into AgentTool objects supporting inputSchema, defaultArgs, or generic fallback schema modes.

Does AgentRunner support LLM providers other than Anthropic?▼

Yes, it supports all pi-mono LLM providers including Anthropic, OpenAI, and Google through the getModel() function. The provider and model are specified in the llmConfig passed during initialization.

How does the agent handle rate limits and transient API errors?▼

The error classifier uses regex-based detection for rate limits, 429, 502/503, timeouts, and network errors. After waitForIdle(), the runner retries up to maxRetries (default 2) with exponential backoff via agent.continue().

What happens when the conversation exceeds the model context window?▼

The context manager keeps messages within a percentage of the context window using prune (drop oldest) or compact (LLM-summarize) strategies. Compaction summaries are persisted as durable memory via the injected memoryProvider.

How do I persist agent messages to my own database?▼

Implement the IAgentRunnerDB interface with listMessages and createMessage methods, then pass it in TAgentInitOpts. The backend can use direct DB calls while TSA delegates to a backend API over HTTP.