Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(agents-api): Fix Box/BoxList problem in system calls #652

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions agents-api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ temporal.db
*.dat
*.dir

# jupyterlab stuff
.virtual_documents/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
10 changes: 8 additions & 2 deletions agents-api/agents_api/activities/execute_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from uuid import UUID

from beartype import beartype
from box import Box, BoxList
from fastapi.background import BackgroundTasks
from temporalio import activity

Expand All @@ -19,9 +20,7 @@
from ..models.agent.get_agent import get_agent as get_agent_query
from ..models.agent.list_agents import list_agents as list_agents_query
from ..models.agent.update_agent import update_agent as update_agent_query
from ..models.docs.create_doc import create_doc as create_doc_query
from ..models.docs.delete_doc import delete_doc as delete_doc_query
from ..models.docs.get_doc import get_doc as get_doc_query
from ..models.docs.list_docs import list_docs as list_docs_query
from ..models.session.create_session import create_session as create_session_query
from ..models.session.delete_session import delete_session as delete_session_query
Expand Down Expand Up @@ -50,6 +49,13 @@ async def execute_system(
arguments = system.arguments
arguments["developer_id"] = context.execution_input.developer_id

# Unbox all the arguments
for key, value in arguments.items():
if isinstance(value, Box):
arguments[key] = value.to_dict()
elif isinstance(value, BoxList):
arguments[key] = value.to_list()

# Convert all UUIDs to UUID objects
if "agent_id" in arguments:
arguments["agent_id"] = UUID(arguments["agent_id"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ def validate_transition_targets(data: CreateTransitionRequest) -> None:
case "finish_branch":
pass # TODO: Implement
case "finish" | "error" | "cancelled":
assert (
data.next is None
), "Next target must be None for finish/finish_branch/error/cancelled"
pass

### FIXME: HACK: Fix this and uncomment

### assert (
### data.next is None
### ), "Next target must be None for finish/finish_branch/error/cancelled"

case "init_branch" | "init":
assert (
Expand Down
Loading