Sign in Get started

Dynamic discovery

Fetch tools.json, Pictograph's agent tools as JSON Schema, and wire them into LangChain, the Vercel AI SDK or your own dispatcher. No adapter needed.

View as Markdown
On this page

For a framework without an SDK adapter, fetch every agent tool as JSON Schema:

curl -H "X-API-Key: pk_live_..." https://api.pictograph.io/api/v1/developer/tools.json

Any role can read it. Each entry has name, description, input_schema, required_role, cost_micro_usd and idempotent. pictograph agents export-tools -o tools.json writes the same file offline.

Source: agents/_registry.py

Your own dispatcher

One function runs any tool call:

from pictograph.agents import create_toolkit

toolkit = create_toolkit()  # reads PICTOGRAPH_API_KEY

specs = toolkit.as_json_schema()  # hand these to your model as its tools


def run_tool(name: str, args: dict) -> object:
    return toolkit.dispatch(
        name=name,
        args=args,
    )

For an app in another language, serve the toolkit over HTTP; your key stays on the server:

from typing import Any

from fastapi import FastAPI
from pictograph.agents import create_toolkit

toolkit = create_toolkit()
app = FastAPI()


@app.get("/tools")
def list_tools() -> list[dict[str, Any]]:
    return toolkit.as_json_schema()


@app.post("/tools/{name}")
def run_tool(name: str, args: dict[str, Any]) -> Any:
    return toolkit.dispatch(
        name=name,
        args=args,
    )

Vercel AI SDK

Tools come from the dispatcher above, and each call goes back to it:

import { anthropic } from '@ai-sdk/anthropic';
import { generateText, jsonSchema, tool, type JSONSchema7 } from 'ai';

const DISPATCHER = 'http://localhost:8000';

type ToolSpec = { name: string; description: string; input_schema: JSONSchema7 };

const specs: ToolSpec[] = await fetch(`${DISPATCHER}/tools`).then((r) => r.json());

const tools = Object.fromEntries(
  specs.map((t) => [
    t.name,
    tool({
      description: t.description,
      inputSchema: jsonSchema(t.input_schema),
      execute: async (args) => {
        const res = await fetch(`${DISPATCHER}/tools/${t.name}`, {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify(args),
        });
        return res.json();
      },
    }),
  ]),
);

const result = await generateText({
  model: anthropic('claude-opus-5-5'),
  tools,
  prompt: 'List my Pictograph datasets',
});
console.log(result.text);

LangChain

Each registry tool has a typed argument model to wrap:

from langchain_core.tools import StructuredTool
from pictograph.agents import REGISTRY, create_toolkit

toolkit = create_toolkit()


def as_langchain(tool):
    return StructuredTool.from_function(
        func=lambda **args: toolkit.dispatch(name=tool.name, args=args),
        name=tool.name,
        description=tool.description,
        args_schema=tool.args_schema,
    )


langchain_tools = [as_langchain(t) for t in REGISTRY]
Copied to clipboard