- Turborepo monorepo with apps/web and packages/database, sdk-python - Next.js 15 app with professional landing page (dark theme, emerald accent) - Prisma schema: Trace, DecisionPoint, Span, Event models with full indexing - Docker Compose: web (port 4200), postgres:16, redis:7, migrate service - Python SDK package stubs: init, trace decorator, log_decision, integrations - Multi-stage Dockerfile for standalone Next.js production build
33 lines
1013 B
Python
33 lines
1013 B
Python
"""Decision logging for tracking agent decision points."""
|
|
|
|
from typing import Any, Dict, List
|
|
|
|
|
|
def log_decision(
|
|
type: str,
|
|
chosen: Any,
|
|
alternatives: List[Any],
|
|
reasoning: Optional[str] = None,
|
|
) -> None:
|
|
"""Log a decision point in the agent's reasoning.
|
|
|
|
Args:
|
|
type: Type of decision (e.g., "tool_selection", "routing", "retry").
|
|
chosen: The option that was selected.
|
|
alternatives: List of alternatives that were considered.
|
|
reasoning: Optional explanation for the decision.
|
|
|
|
Example:
|
|
log_decision(
|
|
type="tool_selection",
|
|
chosen="search",
|
|
alternatives=["search", "calculate", "browse"],
|
|
reasoning="Search is most appropriate for finding information"
|
|
)
|
|
"""
|
|
print(f"[AgentLens] Decision logged: {type}")
|
|
print(f"[AgentLens] Chosen: {chosen}")
|
|
print(f"[AgentLens] Alternatives: {alternatives}")
|
|
if reasoning:
|
|
print(f"[AgentLens] Reasoning: {reasoning}")
|