|
| 1 | +- [[LangChain/Ecosystem]] |
| 2 | + - for some reason it's always so hard for me to find [Observability in Studio - Docs by LangChain](https://docs.langchain.com/langsmith/observability-studio#full-example-configuration), which is, to the best of my knowledge, one of the only pieces of documentation which shows how to do this configuration of langgraph assistants using `Annotated[Literal{}]` and `json_schema_extra` |
| 3 | + - ```python |
| 4 | + ## Using Pydantic |
| 5 | + from pydantic import BaseModel, Field |
| 6 | + from typing import Annotated, Literal |
| 7 | + |
| 8 | + class Configuration(BaseModel): |
| 9 | + """The configuration for the agent.""" |
| 10 | + |
| 11 | + system_prompt: str = Field( |
| 12 | + default="You are a helpful AI assistant.", |
| 13 | + description="The system prompt to use for the agent's interactions. " |
| 14 | + "This prompt sets the context and behavior for the agent.", |
| 15 | + json_schema_extra={ |
| 16 | + "langgraph_nodes": ["call_model"], |
| 17 | + "langgraph_type": "prompt", |
| 18 | + }, |
| 19 | + ) |
| 20 | + |
| 21 | + model: Annotated[ |
| 22 | + Literal[ |
| 23 | + "anthropic/claude-sonnet-4-5-20250929", |
| 24 | + "anthropic/claude-haiku-4-5-20251001", |
| 25 | + "openai/o1", |
| 26 | + "openai/gpt-4o-mini", |
| 27 | + "openai/o1-mini", |
| 28 | + "openai/o3-mini", |
| 29 | + ], |
| 30 | + {"__template_metadata__": {"kind": "llm"}}, |
| 31 | + ] = Field( |
| 32 | + default="openai/gpt-4o-mini", |
| 33 | + description="The name of the language model to use for the agent's main interactions. " |
| 34 | + "Should be in the form: provider/model-name.", |
| 35 | + json_schema_extra={"langgraph_nodes": ["call_model"]}, |
| 36 | + ) |
| 37 | + |
| 38 | + ## Using Dataclasses |
| 39 | + from dataclasses import dataclass, field |
| 40 | + |
| 41 | + @dataclass(kw_only=True) |
| 42 | + class Configuration: |
| 43 | + """The configuration for the agent.""" |
| 44 | + |
| 45 | + system_prompt: str = field( |
| 46 | + default="You are a helpful AI assistant.", |
| 47 | + metadata={ |
| 48 | + "description": "The system prompt to use for the agent's interactions. " |
| 49 | + "This prompt sets the context and behavior for the agent.", |
| 50 | + "json_schema_extra": {"langgraph_nodes": ["call_model"]}, |
| 51 | + }, |
| 52 | + ) |
| 53 | + |
| 54 | + model: Annotated[str, {"__template_metadata__": {"kind": "llm"}}] = field( |
| 55 | + default="anthropic/claude-3-5-sonnet-20240620", |
| 56 | + metadata={ |
| 57 | + "description": "The name of the language model to use for the agent's main interactions. " |
| 58 | + "Should be in the form: provider/model-name.", |
| 59 | + "json_schema_extra": {"langgraph_nodes": ["call_model"]}, |
| 60 | + }, |
| 61 | + ) |
| 62 | + ``` |
| 63 | +- [[DevContainer/Report/25/12/Multi-Env DevContainer Setup]] |
| 64 | + - This morning I was about to start on [🐛 fix(devcontainer): docker-compose.override.yml not picked up by JetBrains Gateway rebuilds · Issue #718 · codekiln/langstar](https://github.com/codekiln/langstar/issues/718) with the plan to make multiple devcontainer configurations in [[Langstar]], and I opened a devcontainer for [[JetBrains/RustRover]] inside of a [[git/worktree]] that was at `<repo-root>/wip/<branch>`. When I got it open, I had problems with accessing git, which makes sense; there was no [[git/.git]] directory. |
| 65 | + - This made me wonder ... what's the fastest, best, most secure way to spin up a different devcontainer for each [[AI/Coding/Agent]] while keeping them isolated? Sure, git worktrees let you parallelize development, but the ability to do git work in that environment is conditioned on your ability to access the .git directory. |
| 66 | + - But if I really am making a clone from VCS of the entire repo, including the .git dir, and running it in its own unique space with [[Docker]], then why are [[git/worktree]]s even necessary? |
| 67 | + - |
0 commit comments