generated from langchain-ai/integration-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
libs/langgraph-checkpoint-mongodb/tests/integration_tests/agents.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from typing import Literal, Union | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
# define these objects to avoid importing langchain_core.agents | ||
# and therefore avoid relying on core Pydantic version | ||
class AgentAction(BaseModel): | ||
tool: str | ||
tool_input: Union[str, dict] | ||
log: str | ||
type: Literal["AgentAction"] = "AgentAction" | ||
|
||
model_config = { | ||
"json_schema_extra": { | ||
"description": ( | ||
"""Represents a request to execute an action by an agent. | ||
The action consists of the name of the tool to execute and the input to pass | ||
to the tool. The log is used to pass along extra information about the action.""" | ||
) | ||
} | ||
} | ||
|
||
|
||
class AgentFinish(BaseModel): | ||
"""Final return value of an ActionAgent. | ||
Agents return an AgentFinish when they have reached a stopping condition. | ||
""" | ||
|
||
return_values: dict | ||
log: str | ||
type: Literal["AgentFinish"] = "AgentFinish" | ||
model_config = { | ||
"json_schema_extra": { | ||
"description": ( | ||
"""Final return value of an ActionAgent. | ||
Agents return an AgentFinish when they have reached a stopping condition.""" | ||
) | ||
} | ||
} |