Skip to main content
The Agent API provides endpoints for interacting with wit’s AI coding assistant. The agent can answer questions about code, implement features, and make changes to your repository.

Overview

All agent endpoints are available through the tRPC API at /trpc/agent.*. The agent supports multiple modes:
  • PM Mode: Product management, planning, and documentation
  • Code Mode: Implementation, debugging, and code review

Status

Check AI availability and configured providers.

Response


Get Modes

Get available agent modes.

Response


Sessions

Create Session

Create a new chat session with the agent.

Response


Get Session


List Sessions

List user’s chat sessions.

Update Session


Delete Session


Chat

Send Message

Send a message and get a response.

Response


Stream Chat

Stream a chat response in real-time (subscription).
Streams chunks of the response as they’re generated.

Get Messages

Get all messages in a session.

Response


File Changes

The agent can propose file changes that need approval before being applied.

Get Pending Changes

Get proposed changes awaiting approval.

Response


Approve Change

Approve and apply a proposed change.

Response


Reject Change

Reject a proposed change.

Approve All Changes

Approve and apply all pending changes in a session.

Response


Agent Modes

PM Mode

The PM (Product Manager) agent helps with:
  • Writing documentation
  • Creating project plans
  • Drafting issues and tickets
  • Explaining code architecture
  • Writing specifications

Code Mode

The Code agent helps with:
  • Implementing features
  • Fixing bugs
  • Refactoring code
  • Writing tests
  • Code review suggestions

Usage Examples

TypeScript Client

Streaming Example


Streaming Endpoint

For web applications, there’s also an HTTP streaming endpoint:
Returns a Server-Sent Events (SSE) stream.