feat(ai-foundry): add TypeSpec for Foundry Routines#42779
Conversation
Next Steps to Merge⌛ Please wait. Next steps to merge this PR are being evaluated by automation. ⌛Comment generated by summarize-checks workflow run. |
|
@copilot resolve the merge conflicts in this pull request |
- Add src/routines/models.tsp with RoutineTrigger (schedule/timer/github_issue), RoutineAction (invoke_agent_responses_api / invoke_agent_invocations_api), RoutineDispatchPayload, RoutineRunDto, and RoutineRunsResponse models - Add src/routines/routes.tsp with createOrUpdate, get, list, delete, dispatch, dispatchAsync, and listRuns operations - Add routines_v1_preview feature flag to FoundryFeaturesOptInKeys - Wire up main.tsp import - Regenerate openapi3 output
8275815 to
8570a43
Compare
API Change CheckAPIView identified API level changes in this PR and created the following API reviews
Comment generated by After APIView workflow run. |
| string, | ||
|
|
||
| @doc("Cron-based recurring schedule trigger.") | ||
| Schedule: "schedule", |
There was a problem hiding this comment.
nit:
| Schedule: "schedule", | |
| schedule: "schedule", |
| Schedule: "schedule", | ||
|
|
||
| @doc("One-shot timer trigger.") | ||
| Timer: "timer", |
There was a problem hiding this comment.
nit:
| Timer: "timer", | |
| timer: "timer", |
| Timer: "timer", | ||
|
|
||
| @doc("GitHub issue event trigger.") | ||
| GitHubIssue: "github_issue", |
There was a problem hiding this comment.
nit
| GitHubIssue: "github_issue", | |
| github_issue: "github_issue", |
| type: RoutineTriggerType.Timer; | ||
|
|
||
| @doc("One-shot fire time in ISO 8601 format. Example: `\"2030-01-02T03:04:05Z\"`.") | ||
| at?: string; |
There was a problem hiding this comment.
probably need a more expressive name.
| string, | ||
|
|
||
| @doc("Invoke a published agent via the workspace responses API.") | ||
| InvokeAgentResponsesApi: "invoke_agent_responses_api", |
There was a problem hiding this comment.
From the feedback in the conceptual spec:
| InvokeAgentResponsesApi: "invoke_agent_responses_api", | |
| agent_response: "agent_response", |
|
|
||
| #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "We need explicit definition for header support" | ||
| @doc("Get a routine by name.") | ||
| get is Azure.Core.Foundations.ResourceOperation< |
| #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "We need explicit definition for header support" | ||
| @doc("List all routines.") | ||
| @Rest.listsResource(Routine) | ||
| list is Azure.Core.Foundations.ResourceList< |
There was a problem hiding this comment.
similar as above: use the paged operation archetype with the types defined in servicepatterns.tsp, e.g:
@list
listRoutines is FoundryDataPlanePreviewOperation<
FoundryFeaturesOptInKeys.routines_v1_preview,
{
...CommonPageQueryParameters;
},
AgentsPagedResult<Routine>
>;| @doc("List execution history for a routine.") | ||
| @route("routines/{routine_name}/runs") | ||
| @get | ||
| listRuns is FoundryDataPlaneOperation< |
There was a problem hiding this comment.
same as the other list operation
|
|
||
| #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "We need explicit definition for header support" | ||
| @doc("Asynchronously dispatch a routine. Returns immediately after enqueueing the action.") | ||
| @route("routines/{routine_name}:dispatchAsync") |
|
|
||
| ...RoutinesPreviewHeader; | ||
|
|
||
| @Http.bodyRoot |
There was a problem hiding this comment.
since DispatchRoutineRequest does not have non-body fields (path, query, etc)... use @Body here
…conversation field - Expand TimerRoutineTrigger.at @doc to cover ISO-8601, local+tz, and duration formats (e.g. '30m', '2h'); note reminder tool writes '{minutes}m' - Rename conversation_id -> conversation in InvokeAgentResponsesApiRoutineAction to match actual wire format Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Adds TypeSpec models and routes for the Foundry Routines feature, based on the C# service contracts in Vienna.
New files
src/routines/models.tsp— all Routines domain modelssrc/routines/routes.tsp— 7 REST operationsModified files
src/common/models.tsp— addsroutines_v1_preview: "Routines=V1Preview"toFoundryFeaturesOptInKeysmain.tsp— importssrc/routines/routes.tspopenapi3/— regenerated OpenAPI outputRoutes
/routines/{routineName}/routines/{routineName}/routines/routines/{routineName}/routines/{routineName}:dispatch/routines/{routineName}:dispatchAsync/routines/{routineName}/runsKey model design
RoutineTriggerdiscriminated ontype:"schedule","timer","github_issue"RoutineActiondiscriminated ontype:"invoke_agent_responses_api","invoke_agent_invocations_api"Routine.triggersisRecord<RoutineTrigger>(named dict, matching C#Dictionary<string, RoutineTrigger>)RoutineDispatchPayloaddiscriminated ontypematchingRoutineActionTypeFoundry-Features: Routines=V1Previewheader