Kate Docs
Quickstart

Buyer Quickstart

Instrument your agent, discover knowledge gaps, and acquire specialized knowledge.

This guide walks you through instrumenting your agent with Kate tracing, running discovery to find knowledge gaps, and querying acquired knowledge.

Prerequisites

  • Kate account with an API key
  • pip install projectkate
  • An AI agent you want to improve

Step 1: Register Your Agent

First, register your agent with Kate so the platform knows what to evaluate and improve.

import asyncio
from projectkate import KateClient

async def main():
    async with KateClient(api_key="your-api-key") as client:
        agent = await client.agents.create(
            name="Content Marketing Strategist",
            domain="marketing",
            objective="Generate data-driven content strategies for B2B SaaS companies",
        )
        print(f"Agent registered: {agent.name} ({agent.id})")

asyncio.run(main())

Step 2: Add Tracing

Instrument your agent so Kate can observe its behavior and identify knowledge gaps.

import projectkate

# Initialize the SDK in your agent's entrypoint
projectkate.init(
    api_url="https://api.projectkate.com",
    api_key="your-api-key",
    agent_name="Content Marketing Strategist",
)

# Decorate your agent's key functions
@projectkate.trace("generate_strategy")
async def generate_content_strategy(topic: str, audience: str) -> str:
    # Your existing agent logic
    response = await llm.chat(
        messages=[{"role": "user", "content": f"Create a content strategy for {topic} targeting {audience}"}]
    )
    return response.content

@projectkate.trace("research_keywords")
async def research_keywords(topic: str) -> list[str]:
    # Your existing research logic
    ...

Run your agent normally. Kate records the traces in the background - what the agent was asked, what it produced, how long each step took, and what tools it called.

Step 3: Create a Run

Wrap your agent's execution in a run so Kate can evaluate it as a unit:

async with KateClient(api_key="your-api-key") as client:
    # Create a run
    run = await client.runs.create(
        agent_id=agent.id,
        trigger="manual",
    )

    # Execute your agent (traces are captured automatically)
    result = await generate_content_strategy("AI in healthcare", "CTOs")

    # Mark the run as complete  -  triggers evaluation
    await client.runs.complete(
        agent_id=agent.id,
        run_id=run.id,
    )

Step 4: Configure Discovery

Tell Kate to find knowledge that could fill your agent's gaps:

config = await client.discovery.configure(
    agent_id=agent.id,
    mode="manual",                    # "manual" or "scheduled"
    max_tokens_per_action=500,        # Budget per discovery action
    min_compatibility_score=0.5,      # Minimum artifact match quality
    max_candidates_per_gap=3,         # How many candidates per gap
)
print(f"Discovery configured: mode={config.mode}")

Step 5: Run Discovery

Trigger a discovery cycle to find relevant artifacts:

# Run discovery
result = await client.discovery.run(agent_id=agent.id)
print(f"Discovery: {result}")

# Review what was found
actions = await client.discovery.list_actions(agent_id=agent.id)
for action in actions:
    print(f"  [{action.action_type}] {action.status}: {action.summary}")

Kate analyzes your agent's traces, identifies knowledge gaps (e.g., "agent gives generic SEO advice - lacks keyword research frameworks"), finds compatible artifacts, and presents candidates.

Step 6: Subscribe and Query

Once you've reviewed the candidates and decided to subscribe:

# Subscribe to an artifact (done via dashboard or API)
# Then query the artifact
response = await client.query.ask(
    artifact_id="artifact-id",
    agent_id=agent.id,
    question="What's the best keyword clustering strategy for B2B SaaS content?",
)
print(f"Answer: {response.answer}")
print(f"Confidence: {response.confidence}")
print(f"Tokens charged: {response.tokens_charged}")

Each query returns answers grounded in the seller's domain expertise without ever seeing the underlying content.

Next Steps

On this page