DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to script agent sessions with the TrueForge TypeScript SDK

Drive agent sessions and turns from your own TypeScript code using the HTTP API and SDK.

Short answer: Start TrueForge with npx @truefoundry/trueforge@latest; then install the client with npm install @truefoundry/trueforge-sdk in your project; create a session with the SDK and send a turn that asks the agent for <task>. All steps.

Who it is forA developer who wants to call an agent from a script, service, or pipeline instead of the chat UI.

The problemTeams need agent runs that other code can start, track, and read back, not only interactive chat.

The outcomeA script that creates a session, sends turns, reads events, and produces a result that can be inspected later in Sessions.

What you need first

  • A machine where you can run npx, for the local quickstart
  • API access to at least one model provider you plan to connect (OpenAI, Anthropic, Google Gemini, or an OpenAI-compatible endpoint)
  • Optional: credentials for any remote MCP server you plan to use (header auth or OAuth)
  • For hosted mode: Postgres and Redis, plus Docker Compose, Helm, or Railway

Steps

  1. Start TrueForge with npx @truefoundry/trueforge@latest.
  2. Install the client with npm install @truefoundry/trueforge-sdk in your project. (inferred, check the README)
  3. Create a session with the SDK and send a turn that asks the agent for <task>.
  4. Read the streamed events and save the final answer to <output-file>.
  5. Open Sessions in the UI and check that the turns, tool calls, and token counts match your script's output.

Prompt for your agent

In the truefoundry/trueforge repo, use the TypeScript SDK @truefoundry/trueforge-sdk to create a session against a running local TrueForge instance and send one turn asking for <task>. Output the final answer and the session ID. Verify that the same session appears in the Sessions view with its turns and tool calls.

Caveat. The README says maintainers regenerate the SDK after merge, so check the API Reference for current paths before you hard-code calls.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for truefoundry/trueforge and "Script agent sessions with the TrueForge TypeScript SDK"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer