Skip to content

agents

FastAPI endpoint functions for managing agent resources.

Attributes

RESOURCE_AGENTS module-attribute

RESOURCE_AGENTS = 'Agents'

agents_router module-attribute

agents_router = APIRouter(
    prefix=format_path(RESOURCE_AGENTS),
    tags=[RESOURCE_AGENTS],
    responses=DEFAULT_HTTP_ERROR_RESPONSES,
)

Classes

Functions

bind_collection async

bind_collection(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Bind an existing memory collection to the agent

create_agent async

create_agent(
    fastapi_request: Request,
    request: AgentCreateRequestV1,
    namespace: str = namespace_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Create a new agent resource

generate_agent_persona async

generate_agent_persona(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    min_memories: int | None = Query(
        default=None,
        gt=0,
        title="Minimum Memories",
        description="Minimum number of memories needed to generate persona",
    ),
    max_memories: int | None = Query(
        default=None,
        gt=0,
        title="Maximum Memories",
        description="Maximum number of memories used to generate persona",
    ),
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Analyzes agent’s persona and memories to generate a list of values that the agent holds. This endpoint will only return the generated value statement and will not update the agent’s internal state.

get_agent async

get_agent(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Get an agent resource

hard_delete_agent async

hard_delete_agent(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    dry_run: bool = Query(
        default=True,
        title="Dry Run",
        description="When set to True, the agent will not be actually deleted, only the actions will be simulated",
    ),
    delete_vectors: bool = Query(
        default=True,
        title="Delete Vectors",
        description="When set to true, vector data will also be deleted from the agent's episodic memory collection",
    ),
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Hard delete an agent and associated resources

read_corpus async

read_corpus(
    fastapi_request: Request,
    request: ReadCorpusRequestV1,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    queue: str = checkmate_queue_query_param,
    tags: List[str] = checkmate_tags_query_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Read text corpus into a new memory collection

revoice async

revoice(
    request: AgentReVoiceRequestV1,
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Execute operation where the agent re-voices the provided memory collection

search_agent_memories async

search_agent_memories(
    context: Annotated[
        str,
        Body(
            description="Memory lookup context",
            media_type=text / plain,
        ),
    ],
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    top_k_vectors: int = Query(
        default=10,
        gt=0,
        title="Top K Vectors",
        description="Top K vectors to return from vector database from each memory collection prior to scoring & filtering",
    ),
    relevance_alpha: float = Query(
        default=1.0,
        ge=0.0,
        le=1.0,
        title="Relevance Alpha",
        description="Weight multiplier for relevance score",
    ),
    importance_alpha: float = Query(
        default=1.0,
        ge=0.0,
        le=1.0,
        title="Importance Alpha",
        description="Weight multiplier for importance score",
    ),
    recency_alpha: float = Query(
        default=1.0,
        ge=0.0,
        le=1.0,
        title="Recency Alpha",
        description="Weight multiplier for recency score",
    ),
    min_score: float = Query(
        default=0.0,
        ge=0.0,
        title="Minimum Score",
        description="Memories with an overall score below this threshold will be filtered out",
    ),
    max_memories: int = Query(
        default=10,
        gt=0,
        title="Maximum Memories",
        description="Maximum number of memories that will be returned",
    ),
    max_memory_strategy: str = Query(
        default="HARD_LIMIT",
        title="Maximum Memory Strategy",
        description="Determines how the maximum number of memories is enforced. When set to 'HARD_LIMIT' then the number of memories returned will not exceed 'max_memories'. When set to 'COLLECTION_LIMIT', then up to 'max_memories' from each collection bound to the agent will be returned. When set to 'SUMMARY' a LLM chain will be used to summarize recalled memories that meet the min_score threshold",
    ),
    update_access: bool = Query(
        False,
        description="Update access count on retrieved memories",
    ),
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Query an agent’s memories

soft_delete_agent async

soft_delete_agent(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Soft delete a agent resource

unbind_collection async

unbind_collection(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    collection: str = collection_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Unbind a memory collection from the agent

undelete_agent async

undelete_agent(
    fastapi_request: Request,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Undeletes an agent resource

update_agent async

update_agent(
    fastapi_request: Request,
    request: AgentUpdateRequestV1,
    namespace: str = namespace_path_param,
    agent: str = agent_path_param,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Update an agent resource