Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/oss/src/apis/fastapi/tracing/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ async def ingest_spans( # MUTATION
)

link_response = OTelLinksResponse(
count=len(links) + len(dropped),
count=len(links),
links=links,
dropped=dropped or None,
)
Expand Down
4 changes: 3 additions & 1 deletion api/oss/src/core/queries/dtos.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List, Optional
from uuid import UUID

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field


from oss.src.core.tracing.dtos import Filtering, Formatting
Expand Down Expand Up @@ -119,6 +119,8 @@ class QueryVariantQuery(VariantQuery):


class QueryRevisionData(BaseModel):
model_config = ConfigDict(extra="forbid")

formatting: Optional[Formatting] = None
filtering: Optional[Filtering] = None
windowing: Optional[Windowing] = None
Expand Down
5 changes: 3 additions & 2 deletions api/oss/src/core/shared/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def __init__(
def __str__(self):
_message = self.message

for key, value in self.conflict.items():
_message += f" {key}={value}"
if self.conflict:
for key, value in self.conflict.items():
_message += f" {key}={value}"

return _message
4 changes: 3 additions & 1 deletion api/oss/src/core/testsets/dtos.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional, List, Tuple
from uuid import UUID

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field

from oss.src.core.shared.dtos import (
sync_alias,
Expand Down Expand Up @@ -134,6 +134,8 @@ class TestsetVariantQuery(VariantQuery):


class TestsetRevisionData(BaseModel):
model_config = ConfigDict(extra="forbid")

testcase_ids: Optional[List[UUID]] = None
testcases: Optional[List[Testcase]] = None

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/reference/api-guide/10-tracing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Each span also declares its role through `ag.type.span`:
| `chat`, `completion` | Chat-completion or completion calls. |
| `embedding`, `query`, `rerank` | Index and retrieval calls. |

## References
## References {#references-and-entity-linking}

A reference links a trace (or a span) back to the Agenta entity that produced or triggered it. References live under `ag.references.<key>` and each value names an entity revision:

Expand Down Expand Up @@ -125,7 +125,7 @@ The Agenta-native ingest endpoints `POST /tracing/spans/ingest` and `POST /trace

:::

### How ingest works
### How ingest works {#async-write-contract-202}

Every ingest endpoint returns `202 Accepted` *before* the spans are persisted. The router parses the payload, hands the spans off to an async worker, and responds immediately. This keeps the ingest buffer fast, so instrumented apps do not block on telemetry.

Expand Down
16 changes: 6 additions & 10 deletions sdks/python/agenta/sdk/engines/running/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,11 @@
{user_code}

// Execute and capture result
let result = evaluate(app_params, inputs, output, correct_answer);
let result: number | null = evaluate(app_params, inputs, output, correct_answer);

// Ensure result is a number
result = Number(result);
if (!Number.isFinite(result)) {{
result = null;
}}
const resultNum = Number(result);
result = Number.isFinite(resultNum) ? resultNum : null;

// Print result for capture
console.log(JSON.stringify({{ result: result }}));
Expand Down Expand Up @@ -137,13 +135,11 @@
{user_code}

// Execute and capture result
let result = evaluate(inputs, outputs, trace);
let result: number | null = evaluate(inputs, outputs, trace);

// Ensure result is a number
result = Number(result);
if (!Number.isFinite(result)) {{
result = null;
}}
const resultNum = Number(result);
result = Number.isFinite(resultNum) ? resultNum : null;

// Print result for capture
console.log(JSON.stringify({{ result: result }}));
Expand Down
2 changes: 2 additions & 0 deletions sdks/python/agenta/sdk/models/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ class WorkflowQueryFlags(BaseModel):


class WorkflowRevisionData(BaseModel):
model_config = ConfigDict(extra="forbid")

uri: Optional[str] = None

url: Optional[str] = None
Expand Down
Loading