AS
Embed & Developer

Agents SDK

Build agent graphs on top of your BeforeQuery knowledge base

What is Agents SDK?

The @beforequery/agents SDK is an open-source TypeScript library for building agent graphs — coordinator and specialist agent structures that can call BeforeQuery's search, MCP server, and external tools. It works in Node.js and edge runtimes and is MIT licensed.

Integration

How BeforeQuery works with Agents SDK

Everything you can do once the integration is connected.

defineAgent and runAgent primitives

Define agent graphs with typed inputs and outputs using defineAgent. Execute them with runAgent, which handles LLM orchestration, tool calls, and human approval pauses.

Built-in MCP and A2A clients

The SDK ships with mcpClient (for connecting to BeforeQuery's MCP server or any MCP endpoint) and a2aClient (for agent-to-agent communication following the A2A protocol).

Human approval integration

Pause agent execution pending human review. The approval queue in the BeforeQuery dashboard surfaces pending decisions, and the SDK resumes execution after approval or rejection.

Observability and tracing

Every agent run is traced in BeforeQuery's observability dashboard. Inspect LLM calls, tool invocations, latency, and costs per agent step.

Setup

How to set it up

1

Install: npm install @beforequery/agents

2

Define an agent graph using defineAgent, specifying specialist agents, their tools, and the coordinator logic.

3

Run the agent with runAgent, passing your BeforeQuery API key. Agent traces appear in the BeforeQuery dashboard automatically.

Ready to connect Agents SDK?

Start free. No credit card required. Connect your first integration in under 5 minutes.