base.py 550 B

1234567891011
  1. from typing import Annotated
  2. from pydantic import BaseModel, Field
  3. from langchain_core.tools import InjectedToolArg
  4. from ..context import AgentContext
  5. # Base arguments schema for tools that require context, used to inject AgentContext into tool actions
  6. class BaseToolArgsWithContextSchema(BaseModel):
  7. context: Annotated[AgentContext, InjectedToolArg] = Field(description="The context for the agent to interact with the browser, file system, etc.")
  8. class Config:
  9. arbitrary_types_allowed = True # AgentContext is a complex custom type