Skip to main content

Executing an Agent

Use the POST /agents/{id}/executions endpoint to run an agent with input and receive the output.
Want to customize agent executions? You can add optional parameters like: - Dynamic Learning — enable learning from past executions - Tenant ID — isolate learning per customer
  • Strict Mode — validate input strictly against schema - Versioning — execute a specific version of an agent - Model Override — specify a custom model and reasoning level

Authorization

To access the Logic API, you will need to provide an authorization token. This token is used to authenticate your requests and ensure that only authorized users can access your agents.
Learn more about authorization and how to set up your API token in the Authorization section.

Generic Request Example

To evaluate the agent, make a POST request to the endpoint with your input as the body. Calling an agent will differ depending on the input schema of your agent. The following example shows how to make a request to an agent of your choosing. You can see a more specific example below.
curl -X POST 'https://api.logic.inc/v1/agents/{agent_id}/executions'
    -H "Authorization: Bearer $LOGIC_API_TOKEN"
    -H "Content-Type: application/json" -d '{
      {YOUR INPUT JSON HERE}
    }'
Replace any {id} in the example code, such as {agent_id} with the ID you need for your specific API call.
Replace {YOUR INPUT JSON HERE} with the correct input for your agent. You can find the required fields in your agent’s Input Schema.

Specific Example Request

Making a request to an agent will differ depending on the input schema of your agent. For this example, the input schema requires a content field. This agent is used as a Redact PII API. You pass in a string, and it will return the string with PII redacted, as well as an array of the redacted entities. The following example shows how to make a request to this agent.
curl -X POST 'https://api.logic.inc/v1/agents/d0844039-9f16-40ba-b93e-405f043ef88a/executions'
    -H "Authorization: Bearer $LOGIC_API_TOKEN"
    -H "Content-Type: application/json" -d '{
      "content": "Steve emailed me at my personal address: mary@yahoo.com."
    }'
This agent redacts PII from a block of text. Your agent may expect different input—refer to its input schema for details.

Example Response

{
  "redactedText": "{{ name }} emailed me at my personal address: {{ email }}.",
  "redactedEntities": ["Steve", "mary@yahoo.com"]
}