File size: 1,447 Bytes
c2df2b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """Define the configurable parameters for the agent."""
from __future__ import annotations
import os
from dataclasses import dataclass, field, fields
from typing import Annotated
from . import prompts
@dataclass(kw_only=True)
class Context:
"""The context for the agent."""
system_prompt: str = field(
default=prompts.SYSTEM_PROMPT,
metadata={
"description": "The system prompt to use for the agent's interactions. "
"This prompt sets the context and behavior for the agent."
},
)
model: Annotated[str, {"__template_metadata__": {"kind": "llm"}}] = field(
default="anthropic/claude-sonnet-4-5-20250929",
metadata={
"description": "The name of the language model to use for the agent's main interactions. "
"Should be in the form: provider/model-name."
},
)
max_search_results: int = field(
default=10,
metadata={
"description": "The maximum number of search results to return for each search query."
},
)
def __post_init__(self) -> None:
"""Fetch env vars for attributes that were not passed as args."""
for f in fields(self):
if not f.init:
continue
if getattr(self, f.name) == f.default:
setattr(self, f.name, os.environ.get(f.name.upper(), f.default))
|