Agents
Using Agent Service Endpoints
How to interact with agents built in Agent Service.
Overview
Clients call through the SGP API to Agent Service in order to CRUD agent configs and execute agents. Agent configs are stored in Agents DB, together with the internal run states of the agents. The service also talks to secrets vault (e.g. AWS secrets manager) and blob store (e.g. AWS S3). For SGP native assets like knowledge bases and LLMs the service also talks back to the SGP API.
Creating Agent Configurations
- Create an Application Specification
- Generates a timestamp.
- Sends a
POST
request to create an application spec (/v4/application-specs
). - Extracts the
application_spec_id
from the response.
- Load YAML Configuration
- Reads a YAML config file (
loop_with_list_demo.yaml
). - Assigns a unique ID (
uuid4()
) and associates anaccount_id
. - Determines the agent type (
STATE_MACHINE
,PLAN
, orWORKFLOW
) based on YAML contents.
- Reads a YAML config file (
- Construct and Send Application Variant Request
- Builds a JSON payload with the application variant details.
- Sends a
POST
request to/v4/application-variants
to create a variant. - Extracts the
variant_id
from the response.
Executing an Agent
You can send a POST request to an agent variant as a standard request or stream the response line by line.
- Process a Variant (Standard Request)
- Sends a
POST
request to process a specific application variant. - Provides input parameters (
object: "tree"
) for processing. - Returns a JSON response containing the processed result.
- Sends a
- Stream Responses from the Variant
- Sends a
POST
request withstream=True
to enable real-time streaming. - Asynchronously processes and prints incoming data as it arrives.
- Sends a