Skip to content

[OPIK-5031][DOCS]: initial PY and TS docs for blueprints;#6101

Closed
aadereiko wants to merge 2 commits intomainfrom
sashaa/OPIK-5031/blueprints-docs
Closed

[OPIK-5031][DOCS]: initial PY and TS docs for blueprints;#6101
aadereiko wants to merge 2 commits intomainfrom
sashaa/OPIK-5031/blueprints-docs

Conversation

@aadereiko
Copy link
Copy Markdown
Collaborator

@aadereiko aadereiko commented Apr 7, 2026

Details

Change checklist

  • User facing
  • Documentation update

Issues

  • Resolves #
  • OPIK-5031

AI-WATERMARK

AI-WATERMARK: [yes|no]

  • If yes:
    • Tools:
    • Model(s):
    • Scope:
    • Human verification:

Testing

Documentation

@aadereiko aadereiko requested review from a team as code owners April 7, 2026 11:49
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

📋 PR Linter Failed

Incomplete Issues Section. You must reference at least one GitHub issue (#xxxx), Jira ticket (OPIK-xxxx), CUST ticket (CUST-xxxx), DEV ticket (DEV-xxxx), or DND ticket (DND-xxxx) under the ## Issues section.

Comment on lines +27 to +33
const MyConfigSchema = z.object({
temperature: z.number().describe("Sampling temperature"),
model: z.string(),
maxTokens: z.number(),
useCot: z.boolean().describe("Enable chain-of-thought reasoning"),
}).describe("MyConfig");
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxTokens in TS vs max_tokens in Python — should we normalize TS serialization in sdks/typescript/src/opik/typeHelpers.ts to snake_case or add an explicit mapping so AgentConfig._resolve_from_backend receives matching keys?

Finding type: Type Inconsistency | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

Before applying, verify this suggestion against the current code. In
apps/opik-documentation/documentation/fern/docs/reference/typescript-sdk/agent-configurations.mdx
around lines 27-33 (the Zod schema example where `maxTokens` is used), the example uses
camelCase fields which conflicts with the Python SDK that expects snake_case keys.
Update the documentation example to use snake_case (e.g., max_tokens) or add a clear
note about automatic camelCase↔snake_case mapping. Then modify
sdks/typescript/src/opik/typeHelpers.ts (around lines 83-168) to canonicalize/serialize
schema field names to lowercase_snake_case when building prefixed backend keys (instead
of using the fieldName verbatim), and verify AgentConfig._resolve_from_backend in the
Python code (around lines 332-345) still accepts those keys; implement a consistent
mapping layer if needed so both SDKs read the same backend payload.

Comment on lines +206 to +209
## Prompts in Configurations

Agent configurations have a direct connection to Opik's prompt management system. **Updating a prompt will automatically update the configuration** — when a prompt referenced by a configuration is updated, the configuration will reflect the updated prompt the next time it is fetched, without needing to publish a new configuration version.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs claim prompt updates auto-update configs, but commits are used for prompt fields via getPromptByCommit so fetched configs retain the old prompt until you publish a new version; should we reword the docs or change the implementation to clarify updates only flow through after publishing unless you explicitly refresh the config version?

Finding type: Logical Bugs | Severity: 🟠 Medium


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

Before applying, verify this suggestion against the current code. In
apps/opik-documentation/documentation/fern/docs/reference/typescript-sdk/agent-configurations.mdx
around lines 206 to 209, the section titled “Prompts in Configurations” currently
claims that “Updating a prompt will automatically update the configuration … without
needing to publish a new configuration version.” This is incorrect because the SDK
serializes prompt fields as commit IDs and blueprints resolve prompts by commit, so a
configuration will continue to reference the old prompt commit until you publish a new
config version (or explicitly refresh the config version). Replace the existing sentence
with a concise clarification stating that prompt references are stored by commit ID,
that updates to prompts do not change already-published config versions, and that users
must publish a new agent config version (or use an explicit refresh mechanism) for
prompt changes to flow into that config; optionally add a short parenthetical note
pointing maintainers to serializeFields and Blueprint.resolvePrompts in the TypeScript
SDK (and the equivalent Python functions) for implementation details.

Comment on lines +1 to +7
---
headline: Agent Configurations | Opik Documentation
og:description: Learn to manage agent configurations with versioning, environment deployments, and real-time updates using Opik's Python and TypeScript SDKs.
og:site_name: Opik Documentation
og:title: Agent Configurations
title: Agent Configurations
---
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agent_configurations.mdx uses snake_case, should we rename it and all references to agent-configurations.mdx?

Finding type: AI Coding Guidelines | Severity: 🟢 Low


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

Before applying, verify this suggestion against the current code. In
apps/opik-documentation/documentation/fern/docs/tracing/agent_configurations.mdx around
lines 1-7 (the file header/frontmatter and filename), the filename uses snake_case but
the project requires descriptive kebab-case. Rename the file to agent-configurations.mdx
(perform git mv), and update every reference to the old path across the repository
(documentation links, sidebar/TOC entries, imports, build or CI config) to the new path.
Ensure the file's frontmatter/title remains unchanged and run a quick link-check or docs
build to verify no broken references remain.

Comment on lines +444 to +455
const client = new Opik();

const prompt = await client.getPrompt({ name: "my-text-prompt" });

const AgentWithPromptsSchema = z.object({
summaryPrompt: z.string().describe("Summary prompt template"),
temperature: z.number(),
}).describe("AgentWithPrompts");

await client.createAgentConfig(
AgentWithPromptsSchema,
{ summaryPrompt: prompt!.prompt, temperature: 0.7 },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

summaryPrompt is set to the raw prompt!.prompt string so it serializes as type="string" and won't auto-update — should we pass a Prompt instance or use z.instanceof(Prompt) in the schema?

Finding type: Type Inconsistency | Severity: 🟠 Medium


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

Before applying, verify this suggestion against the current code. In
apps/opik-documentation/documentation/fern/docs/tracing/agent_configurations.mdx around
lines 444 to 458, the TypeScript example sets summaryPrompt: prompt!.prompt (a raw
string), which serializes as type="string" and prevents the backend from
resolving/updating the prompt. Change the example to accept and pass a Prompt object:
update the schema field to use z.instanceof(Prompt) (or the appropriate Opik Prompt
validator) and import the Prompt type from the SDK, then pass prompt (the Prompt object)
as the value to createAgentConfig instead of prompt!.prompt so the configuration stores
a prompt reference that can auto-update. Ensure the example code shows the updated
import and value usage.

@juanferrub
Copy link
Copy Markdown
Contributor

@aadereiko -> given I expect most users will instruct claude code/codex/cursor to instrument their apps to support this feature, what do you think about adding some kind of guidance on what to tell claude to to do using our skills?

andrescrz
andrescrz previously approved these changes Apr 7, 2026
Comment on lines +144 to +155
import { Opik, track, ChatPrompt } from "opik";
import { z } from "zod";

const client = new Opik();

const fallbackPrompt = await client.getChatPrompt({ name: "my-system-prompt" });

const MyConfigSchema = z.object({
temperature: z.number(),
model: z.string(),
maxTokens: z.number(),
systemPrompt: z.instanceof(ChatPrompt),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAgentConfigVersion(..., fallback) example fetches client.getChatPrompt({ name: "my-system-prompt" }) right before the fallback, so when the backend is down the fallback never gets constructed — should we define/cache the fallback prompt locally (or document shipping it with the agent) instead of fetching it immediately?

Finding type: Logical Bugs | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

Before applying, verify this suggestion against the current code. In
apps/opik-documentation/documentation/fern/docs/reference/typescript-sdk/agent-configurations.mdx
around lines 144 to 165, the example calls client.getChatPrompt({ name:
"my-system-prompt" }) immediately before constructing the fallback, which will throw if
the Opik backend is unreachable and thus never demonstrate the fallback behavior.
Refactor the example to define a local/cached fallbackPrompt (e.g., construct a
ChatPrompt-like object or load a bundled prompt string) and use that in the fallback
object; optionally show a try/catch that attempts to fetch the remote prompt and falls
back to the local prompt if fetching fails. This ensures the fallback path can be
exercised when the backend is down and documents that consumers should bundle or cache
fallback prompts with their agent.

Comment on lines +258 to +262
```typescript
import { Opik, track } from "opik";
import { AgentConfigManager, agentConfigContext } from "opik";
import { z } from "zod";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AgentConfigManager mask example is duplicated in docs/tracing/agent_configurations.mdx, should we centralize it and reference/include it?

Finding type: Code Dedup and Conventions | Severity: 🟢 Low


Want Baz to fix this for you? Activate Fixer

@aadereiko aadereiko force-pushed the sashaa/OPIK-5031/blueprints-docs branch from 8d01e62 to 10622e8 Compare April 7, 2026 15:38
Comment on lines +28 to +34
const MyConfigSchema = z.object({
temperature: z.number().describe("Sampling temperature"),
model: z.string(),
maxTokens: z.number(),
systemPrompt: z.instanceof(ChatPrompt).describe("System prompt for the agent"),
useCot: z.boolean().describe("Enable chain-of-thought reasoning"),
}).describe("MyConfig");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MyConfigSchema is duplicated from the TypeScript tab in docs/tracing/agent_configurations.mdx, should we reuse/include/link that tab instead of copying the snippet?

Finding type: Code Dedup and Conventions | Severity: 🟢 Low


Want Baz to fix this for you? Activate Fixer

@jverre jverre closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants