Skip to content

Establish API pattern with agent specific service error for agentsv1 #34616

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
11 changes: 6 additions & 5 deletions specification/ai/Azure.AI.Agents/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "@azure-tools/typespec-autorest";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "./models.tsp";
import "./servicepatterns.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
Expand All @@ -24,7 +25,7 @@ namespace Azure.AI.Agents;
@post
@route("/assistants")
@added(Versions.v2025_05_01)
op createAgent is Azure.Core.Foundations.Operation<
op createAgent is ServicePatterns.AgentOperation<
{
...CreateAgentOptions;
},
Expand All @@ -46,7 +47,7 @@ op createAgent is Azure.Core.Foundations.Operation<
@added(Versions.v2025_05_01)
op listAgents(...ApiVersionParameter, ...AgentsListOptions): {
...AgentsPagedResult<Agent>;
};
} | ServicePatterns.AgentV1Error;

/**
* Retrieves an existing agent.
Expand All @@ -61,7 +62,7 @@ op listAgents(...ApiVersionParameter, ...AgentsListOptions): {
@get
@route("/assistants/{assistantId}")
@added(Versions.v2025_05_01)
op getAgent is Azure.Core.Foundations.Operation<
op getAgent is ServicePatterns.AgentOperation<
{
/**
* The request details to use when retrieving an agent.
Expand All @@ -83,7 +84,7 @@ op getAgent is Azure.Core.Foundations.Operation<
@post
@route("/assistants/{assistantId}")
@added(Versions.v2025_05_01)
op updateAgent is Azure.Core.Foundations.Operation<
op updateAgent is ServicePatterns.AgentOperation<
{
/**
* The request details to use when modifying an existing agent.
Expand All @@ -105,7 +106,7 @@ op updateAgent is Azure.Core.Foundations.Operation<
@delete
@route("/assistants/{assistantId}")
@added(Versions.v2025_05_01)
op deleteAgent is Azure.Core.Foundations.Operation<
op deleteAgent is ServicePatterns.AgentOperation<
{
/**
* The request details to use when deleting an agent.
Expand Down
16 changes: 16 additions & 0 deletions specification/ai/Azure.AI.Agents/servicepatterns.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import "@azure-tools/typespec-azure-core";

@Versioning.useDependency(Azure.Core.Versions.v1_0_Preview_2)
namespace ServicePatterns;

@error
model AgentV1Error {
error: {
#suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI compatible/openai uses optional nullable"
code?: string | null;
#suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI compatible/openai uses optional nullable"
message?: string | null;
}
}

op AgentOperation<Params extends Reflection.Model, Response> is Azure.Core.Foundations.Operation<Params, Response, ErrorResponse = AgentV1Error>;
Loading
Loading