StartAgent
agents.start_execution(AgentStartExecutionParams**kwargs) -> AgentStartExecutionResponse
POST/gitpod.v1.AgentService/StartAgent
Starts (or triggers) an agent run using a provided agent.
Use this method to:
- Launch an agent based on a known agent
Examples
-
Start an agent with a project ID:
agentId: "b8a64cfa-43e2-4b9d-9fb3-07edc63f5971" codeContext: projectId: "2d22e4eb-31da-467f-882c-27e21550992f"
Parameters
annotations: Optional[Dict[str, str]]
annotations are key-value pairs for tracking external context (e.g., integration session IDs, GitHub issue references). Keys should follow domain/name convention (e.g., “agent-client-session/id”).
runner_id: Optional[str]
runner_id specifies a runner for this agent execution. When set, the agent execution is routed to this runner instead of the runner associated with the environment.
formatuuid
StartAgent
import os
from gitpod import Gitpod
client = Gitpod(
bearer_token=os.environ.get("GITPOD_API_KEY"), # This is the default and can be omitted
)
response = client.agents.start_execution(
agent_id="b8a64cfa-43e2-4b9d-9fb3-07edc63f5971",
code_context={
"project_id": "2d22e4eb-31da-467f-882c-27e21550992f"
},
)
print(response.agent_execution_id){
"agentExecutionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}Returns Examples
{
"agentExecutionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}