Skip to content

Commit

Permalink
fix(agents-api): Executing agent-level integration tools in `tool_cal…
Browse files Browse the repository at this point in the history
…l` step (#778)

<!-- ELLIPSIS_HIDDEN -->


> [!IMPORTANT]
> Adjusts `ToolCallStep` in `TaskExecutionWorkflow` to handle different
integration spec formats with conditional logic for `TaskToolDef`.
> 
>   - **Behavior**:
> - Adjusts `ToolCallStep` handling in `TaskExecutionWorkflow` to
support different integration spec formats.
> - Introduces conditional logic to differentiate `TaskToolDef` from
other specs, adjusting `provider`, `setup`, and `method` extraction.
>   - **Misc**:
>     - Adds `TaskToolDef` import in `__init__.py`.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=julep-ai%2Fjulep&utm_source=github&utm_medium=referral)<sup>
for ed1f234. It will automatically
update as commits are pushed.</sup>


<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
HamadaSalhab authored Oct 30, 2024
1 parent 37e3748 commit 730c142
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions agents-api/agents_api/workflows/task_execution/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
SleepFor,
SleepStep,
SwitchStep,
TaskToolDef,
ToolCallStep,
TransitionTarget,
WaitForInputStep,
Expand Down Expand Up @@ -462,10 +463,21 @@ async def run(
if integration_spec is None:
raise ApplicationError(f"Integration {tool_name} not found")

# FIXME: Refactor this
# Tools that are not defined in the task spec have a different format
if isinstance(integration_spec, TaskToolDef):
provider = integration_spec.spec["provider"]
setup = integration_spec.spec["setup"]
method = integration_spec.spec["method"]
else:
provider = integration_spec.integration.provider
setup = integration_spec.integration.setup.model_dump()
method = integration_spec.integration.method

integration = BaseIntegrationDef(
provider=integration_spec.spec["provider"],
setup=integration_spec.spec["setup"],
method=integration_spec.spec["method"],
provider=provider,
setup=setup,
method=method,
arguments=arguments,
)

Expand Down

0 comments on commit 730c142

Please sign in to comment.