Endpoints
Define callable functions and configure their behavior.
What are Endpoints?
Endpoints are the callable entry points into your agent. Each endpoint maps to a Python function that can be invoked during execution. An agent can have multiple endpoints, each performing a different action.
Example: A "Database Agent" might have endpoints like query, backup, and health_check.
Python: @mcp_endpoint
Each callable function in main.py should be async, accept exactly one argument payload: Dict[str, Any], and use the @mcp_endpoint(description="...") decorator from viksa_ai.runtime. The description is shown to the executor and validated by viksa-agent-validate. See Python SDK and Creating agents.
Endpoint Structure
| Field | Description | Required |
|---|---|---|
| Name | Unique identifier for the endpoint | Yes |
| Module | Python module containing the function | Yes |
| Description | What this endpoint does (for AI selection) | Yes |
| Inputs | References to agent inputs used by this endpoint | No |
| Outputs | References to agent outputs produced | No |
| Timeout | Maximum execution time in seconds | No (default: 300) |
| Enabled | Whether this endpoint is available | No (default: true) |
Endpoint Naming
Endpoints are referenced using the format:
agent_alias.module.function_nameFor example, if your agent has alias db_agent and you have a function health_check in agent.py, the full endpoint would be: db_agent.agent.health_check
Input Mapping
Endpoints reference global agent inputs. When configuring an endpoint, you specify which inputs the function requires:
{
"name": "query",
"module": "agent",
"description": "Execute a SQL query on the database",
"inputs": ["database_name", "query_string"],
"outputs": ["result"],
"timeout": 60
}Enabling and Disabling Endpoints
You can enable or disable individual endpoints without modifying code:
Enabled
Endpoint is available for execution and AI selection.
Disabled
Endpoint exists but won't be used in execution.
User-scoped inputs (invoker binding)
For Channel Hub and other Volt connectors, identity fields such as user_id and user_email must not be filled by the AI. Mark them source: invoker in agent metadata; the platform injects values from your project user directory at dispatch.
Full walkthrough (schema, CSV, agent JSON, Python): Subject binding & project users
{
"name": "user_id",
"type": "string",
"source": "invoker",
"bind": "profile.acme_user_id"
}Using Secrets
Endpoints can reference secrets stored in the Vault. Secrets are injected as environment variables at runtime:
import os
def query_database(query_string: str) -> dict:
# Secret is injected as environment variable
db_password = os.environ.get("DB_PASSWORD")
# Use the secret in your code
connection = connect(password=db_password)
...Best Practices
- Write clear descriptions—the AI uses them to select endpoints
- Set appropriate timeouts based on expected execution time
- Use secrets for credentials—never hardcode sensitive values
- Keep endpoints focused on a single action
- Disable deprecated endpoints instead of deleting them