Initialization
Configure the Kate SDK with projectkate.init() for tracing and remote evaluation.
projectkate.init() configures the SDK for your agent. Call it once at the start of your application, before any traced functions run.
Basic Usage
import projectkate
projectkate.init(
api_url="https://api.projectkate.com",
api_key="your-api-key",
agent_name="Content Marketing Strategist",
)Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_url | str | None | None | Kate platform API URL. Required for remote mode. |
api_key | str | None | None | Your Kate API key. Required for remote mode. |
agent_id | str | None | None | Agent ID to associate traces with. Use this or agent_name. |
agent_name | str | None | None | Agent name to look up. Use this or agent_id. |
agent_objective | str | None | None | Agent objective metadata. |
agent_domain | str | None | None | Agent domain metadata. |
llm_api_key | str | None | None | LLM provider API key (for local evaluation mode). |
llm_provider | str | "anthropic" | LLM provider: "anthropic" or "openai". |
llm_model | str | None | None | Custom model name (uses provider default if None). |
store_results | bool | True | Whether to store evaluation results locally. |
auto_instrument | bool | False | Enable automatic instrumentation of supported libraries. |
Remote Mode vs Local Mode
The SDK operates in one of two modes depending on whether you provide api_url:
Remote Mode (Recommended)
Connect to the Kate platform for tracing, evaluation, discovery, and knowledge exchange.
projectkate.init(
api_url="https://api.projectkate.com",
api_key="your-api-key",
agent_name="My Agent",
)Requires: api_url and api_key.
Local Mode
Run evaluations locally using your own LLM API key, without connecting to the Kate platform. Useful for development and testing.
projectkate.init(
llm_api_key="your-anthropic-key",
llm_provider="anthropic",
)Requires: llm_api_key. Local mode doesn't support discovery, artifacts, or knowledge exchange.
Identifying Your Agent
You can identify the agent by ID or name:
# By ID (faster - no lookup needed)
projectkate.init(
api_url="https://api.projectkate.com",
api_key="your-api-key",
agent_id="550e8400-e29b-41d4-a716-446655440000",
)
# By name (looks up the agent on init)
projectkate.init(
api_url="https://api.projectkate.com",
api_key="your-api-key",
agent_name="Content Marketing Strategist",
)If you use agent_name and the agent doesn't exist yet, you'll need to create it first via the dashboard or KateClient.
Environment Variables
Instead of passing values directly, you can set environment variables:
export KATE_API_KEY="your-api-key"
export KATE_API_URL="https://api.projectkate.com"# SDK will use environment variables as defaults
projectkate.init(agent_name="My Agent")Explicit parameters always override environment variables.