# Invoke agents and manage sessions

Invoke agents from an MCP client or another agent, and create, query, and update invocation sessions. This page does not configure the agent itself, its model, or its tools.

## Prerequisites

Prepare credentials that can access the target workspace and the target agent ID. For service endpoints, authentication, and general request formats, see [Prepare to call an API](../../api-call-basics.md).

Before invocation, you can get the agent invocation instructions. If you need to persist or maintain a session, retain its ID after creating it.

## Call sequence

1. First [get agent invocation instructions](../../../../reference/api/ai-studio/agents/agent-invocation/get-agent-card.md) to confirm invocation information for the target agent.
2. Choose invocation from an MCP client or from another agent based on the caller.
3. To manage context separately, create a session and retain its ID to query, update, or read messages.
4. After invoking or updating, query session details and messages to confirm observable session results.

## API operations

### Get invocation information and invoke an agent

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Get agent invocation instructions | [Get agent invocation instructions](../../../../reference/api/ai-studio/agents/agent-invocation/get-agent-card.md) | Confirm target-agent invocation information before calling it. |
| Invoke from an MCP client | [Invoke from an MCP client](../../../../reference/api/ai-studio/agents/agent-invocation/call-agent-from-mcp-client.md) | The caller is an MCP client. |
| Invoke from another agent | [Invoke from another agent](../../../../reference/api/ai-studio/agents/agent-invocation/call-agent-from-agent.md) | The caller is another agent. |

### Create and maintain sessions

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Create a session | [Create a session](../../../../reference/api/ai-studio/agents/agent-sessions/create-session.md) | You need a session ID to manage context continuously. |
| List sessions | [List sessions](../../../../reference/api/ai-studio/agents/agent-sessions/list-sessions.md) | Select or confirm a target session. |
| Get session details | [Get session details](../../../../reference/api/ai-studio/agents/agent-sessions/get-session.md) | View current information for one session. |
| List session messages | [List session messages](../../../../reference/api/ai-studio/agents/agent-sessions/list-session-messages.md) | View messages in a session. |
| Update a session | [Update a session](../../../../reference/api/ai-studio/agents/agent-sessions/update-session.md) | You have the session ID and need to modify the session. |

## Confirm the result

The invocation action page defines the specific result after invocation. After creating or updating a session, use [Get session details](../../../../reference/api/ai-studio/agents/agent-sessions/get-session.md) and [List session messages](../../../../reference/api/ai-studio/agents/agent-sessions/list-session-messages.md) to confirm session content.

## Next steps

- [Create and maintain agents](agents.md)
- [Monitor runs and handle feedback](runtime-observability-feedback.md)
