# Agent IDs Source: https://docs.logic.inc/api-reference/agents/agent-id How to get the ID of an agent using the Logic API ## Agent IDs When you create an agent in Logic, it is assigned a unique identifier known as the agent ID. This ID is used to reference the agent in API requests and is essential for executing, updating, or deleting the agent. You can find the agent ID in the Logic dashboard, or you can retrieve it using the Logic API. The agent ID is a UUID (Universally Unique Identifier) that looks like this: `a901abfe-398d-447d-a0cc-c071b40339f3`. You can also use the **agent slug**, which is a human-readable version of the agent ID that might look like this: `analyze-invoice-po-notes`. ### Retrieving the Agent slug via the dashboard ![agent integration](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_integration.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=7ac98d7c6ed48851bbc26a971d5db26b) You can find the agent slug in the Logic dashboard by opening the agent and navigating to the **Entrypoints** section. The **REST API** card shows the **Agent ID** (slug) and the execution endpoint, which you can copy directly from there. ### Retrieving a List of Available Agents with the API To retrieve a list of the agents available on your dashboard, you can use the `/v1/agents` endpoint. This will return a JSON object containing the ID of your agent, created and updated dates, the slug you can use to refer to it for API requests, and more. ```bash curl theme={null} curl 'https://api.logic.inc/v1/agents/' -H "Authorization: Bearer $LOGIC_API_TOKEN" ``` ```bash httpie theme={null} http GET https://api.logic.inc/v1/agents/ "Authorization:Bearer $LOGIC_API_TOKEN" ``` ```python python theme={null} import requests headers = { "Authorization": "Bearer YOUR_API_TOKEN" } response = requests.get("https://api.logic.inc/v1/agents/", headers=headers) print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == 'https' LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{LOGIC_API_TOKEN}" response = http.request(request) puts response.code puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; fetch("https://api.logic.inc/v1/agents/", { headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, }, }) .then((res) => res.text()) .then(console.log) .catch(console.error); ``` ```go go theme={null} package main import ( "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { url := "https://api.logic.inc/v1/agents/" req, err := http.NewRequest("GET", url, nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. // Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/") .addHeader("Authorization", "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { System.err.println("Request failed: " + response.code()); return; } System.out.println(response.body().string()); } } } ``` #### Example Agent List ```json theme={null} [ { "id": "a901abfe-398d-447d-a0cc-c071b40339f3", "createdBy": "c04fdb6c-10e3-4abc-81ef-acd4c1b22ecb", "createdAt": "2025-04-28T09:19:09.508Z", "updatedAt": "2025-04-28T09:19:13.863Z", "orgId": "00000000-0000-4000-a000-000000000001", "currentVersionId": "da384a64-339e-422f-8a40-ccdb1cdcbe5e", "description": null, "draftVersionId": null, "draftVersionStatus": null, "slug": "analyze-invoice-po-notes", "title": "Processing Invoices" }, { "id": "9fe247d4-bc32-4ad1-ae2b-ad36428e72ae", "createdBy": "da384a64-339e-422f-8a40-ccdb1cdcbe5e", "createdAt": "2024-10-17T06:28:46.832Z", "updatedAt": "2025-04-28T08:49:20.067Z", "orgId": "00000000-0000-4000-a000-000000000001", "currentVersionId": "f262e499-41e3-42e3-a987-07b7c955eecc", "description": "This guide standardizes the creation of Git commit messages for projects, ensuring each message clearly and concisely represents the staged changes while following a strict house style.", "draftVersionId": "8eac5a51-4026-4a1d-bd50-9caf25bedefb", "draftVersionStatus": "DRAFT", "slug": "generate-commit-message-from-diff-and-branch", "title": "Git Commit Message Guide" } ] ``` ### Retrieving a Specific Agent You can also retrieve info for a specific agent by adding the ID or slug to the end of the `/v1/agents/` endpoint. ```bash curl theme={null} curl 'https://api.logic.inc/v1/agents/{agent_id}/' -H "Authorization: Bearer $LOGIC_API_TOKEN" ``` ```bash httpie theme={null} http GET https://api.logic.inc/v1/agents/{agent_id}/ "Authorization:Bearer $LOGIC_API_TOKEN" ``` ```python python theme={null} import requests headers = { "Authorization": "Bearer YOUR_API_TOKEN" } response = requests.get("https://api.logic.inc/v1/agents/{agent_id}/", headers=headers) print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == 'https' LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{LOGIC_API_TOKEN}" response = http.request(request) puts response.code puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; fetch("https://api.logic.inc/v1/agents/{agent_id}/", { headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, }, }) .then((res) => res.text()) .then(console.log) .catch(console.error); ``` ```go go theme={null} package main import ( "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { url := "https://api.logic.inc/v1/agents/{agent_id}/" req, err := http.NewRequest("GET", url, nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. // Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/{agent_id}/") .addHeader("Authorization", "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { System.err.println("Request failed: " + response.code()); return; } System.out.println(response.body().string()); } } } ``` > [!NOTE] > > Replace any **\{id}** in the example code, such as **\{agent\_id}** with the ID you need for your specific API call. # Input Schema Source: https://docs.logic.inc/api-reference/agents/input-schemas The input schema of an agent ## Input Schema ![schema](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_input_schema.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=51912dc92e8c32a4f78e01e3532f0101) When making a request to an agent, your input and output data will be in JSON format. The structure of this data is defined by the agent's input and output schema. The input schema specifies the format and types of data that the agent expects, while the output schema defines the format and types of data that the agent will return after processing. You can find the input and output schema for each agent on the [Logic Dashboard](https://app.logic.inc). Click on your agent, then click on the `Integration` tab. The input and output schema will be displayed in the `Input Schema` and `Output Schema` sections, respectively. For this example, we will be using the Redact PII agent. This agent is designed to redact **personally identifiable information (PII)** from a given text input. ### Input Schema The input should be a JSON object with the following structure: ```json theme={null} { "content": { "type": "string", "description": "The text content from which PII should be redacted." } } ``` For this agent, the input schema requires a `content` field. The `content` field is a string that contains the PII to be redacted. The agent will process this text and identify any PII present, such as names, email addresses, phone numbers, etc. It will remove them from the text and return them in a separate array. > [!NOTE] > > The input schema will differ depending on your agent. ### Input Example ```json theme={null} { "content": "Steve emailed me at my personal address: mary@yahoo.com." } ``` > [!NOTE] > > In this case, the input is a string containing text. When writing your > agent, you can also use images, audio, and files (such as PDF, Word, Excel, and PowerPoint) as inputs, either as a URL or a base64-encoded string. All supported file types will be converted and processed automatically. # Output Schema Source: https://docs.logic.inc/api-reference/agents/output-schemas The output schema of an agent ## Output Schema ![schema](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_output_schema.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=9da44c1ad628e885ce8f86f09d5c5ed7) When making a request to an agent, your input and output data will be in JSON format. The structure of this data is defined by the agent's input and output schema. The input schema specifies the format and types of data that the agent expects, while the output schema defines the format and types of data that the agent will return after processing. You can find the input and output schema for each agent on the [Logic Dashboard](https://app.logic.inc). Click on your agent, then click on the `Integration` tab. The input and output schema will be displayed in the `Input Schema` and `Output Schema` sections, respectively. For this example, we will be using the Redact PII agent. This agent is designed to redact **personally identifiable information (PII)** from a given text input. ### Output Schema The returned data will be a JSON object of the execution, containing an output field with the following structure: ```json theme={null} { "redactedText": { "type": "string", "description": "The text with all detected PII replaced by appropriate placeholders (e.g., {{ name }}, {{ email }})." }, "redactedEntities": { "type": "array", "description": "A list of entities that were redacted from the original content.", "items": { "type": "string", "description": "A single entity that was redacted from the content." } } } ``` > [!NOTE] > > The output schema will differ depending on your agent. ### Output Example ```json theme={null} { "redactedText": "{{ name }} emailed me at my personal address: {{ email }}.", "redactedEntities": ["Steve", "mary@yahoo.com"] } ``` # Authorization Source: https://docs.logic.inc/api-reference/authorization How to create an API token to access the API ## 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. ### Step 1: Creating an API key ![api keys](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/api_keys.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=09b093a90b61c770ace8b3d487797b45) To create an API key, go to the [API Keys](https://app.logic.inc/settings/organization-settings/api-keys) page in the Logic Dashboard. Click on the **Create Key** button and follow the prompts to generate a new key. Make sure to copy the key and store it in a secure location, as you will not be able to see it again after you close the dialog. ### Step 2: Setting the environment variable You can set the environment variable in your terminal by running the following command: ```bash MacOS/Linux theme={null} export LOGIC_API_TOKEN=ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` ```bash Windows theme={null} set LOGIC_API_TOKEN=ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` Note that setting the environment variable this way will only persist for the current terminal session. If you open a new terminal window, you will need to set the environment variable again. To set the environment variable permanently, you can add the above command to your shell configuration file (e.g., `.bashrc`, `.bash_profile`, or `.zshrc` for MacOS/Linux, or `System Properties` for Windows). ### Step 3: Verifying the environment variable Verify your environment variable is set correctly by running the following command in your terminal: ```bash MacOS/Linux theme={null} echo $LOGIC_API_TOKEN ``` ```bash Windows theme={null} echo %LOGIC_API_TOKEN% ``` If this returns your API key, you have correctly set your environment variable. ## Try Making a Request Now that you have your API token set up, you can try making a request to the Logic API. > [!NOTE] > > Learn more about how to execute an agent using the API in the [Executing an > Agent](/api-reference/executions/executing) section. If you need more information about how agents work in the API, check out the `Input Schema` and `Output Schema` sections of the API Documentation. # Async Execution Source: https://docs.logic.inc/api-reference/execution-params/async-execution How to run an agent asynchronously and poll for the result ## Async Execution By default, an agent execution runs synchronously: the request blocks until the agent finishes and the response contains the output. For long-running agents, you can instead run the execution asynchronously by adding the `execMode` query parameter. The `execMode` parameter accepts two values: * `sync` (default) — the request waits for the agent to finish and returns the output. * `async` — the request returns immediately with an execution record you can poll. > [!NOTE] > > Async execution is useful for long-running or agentic agents, and for starting > many executions in parallel without holding open a request for each one. ### Step 1: Start the execution Add `?execMode=async` to your execution request. Instead of the agent output, you receive an execution object with an `id` and a `status` of `IN_PROGRESS`. ```bash curl theme={null} curl -X POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?execMode=async' -H "Authorization: Bearer $LOGIC_API_TOKEN" -H "Content-Type: application/json" -d '{ {YOUR INPUT JSON HERE} }' ``` ```bash httpie theme={null} http POST 'https://api.logic.inc/v1/agents/{agent_id}/executions' execMode==async "Authorization:Bearer $LOGIC_API_TOKEN" "Content-Type:application/json" --raw '{ {YOUR INPUT JSON HERE} }' ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" response = requests.post( "https://api.logic.inc/v1/agents/{agent_id}/executions", params={"execMode": "async"}, headers={ "Authorization": f"Bearer {LOGIC_API_TOKEN}", "Content-Type": "application/json", }, json={ # Add your agent input here }, ) print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/executions') uri.query = URI.encode_www_form({ execMode: "async" }) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' headers = { "Authorization" => "Bearer #{LOGIC_API_TOKEN}", "Content-Type" => "application/json" } body = { }.to_json request = Net::HTTP::Post.new(uri, headers) request.body = body response = http.request(request) puts response.code puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const url = new URL("https://api.logic.inc/v1/agents/{agent_id}/executions"); url.searchParams.set("execMode", "async"); const response = await fetch(url, { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ // Add your agent input here }), }); console.log(await response.json()); ``` ```go go theme={null} package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { url := "https://api.logic.inc/v1/agents/{agent_id}/executions?execMode=async" jsonStr := `{ {YOUR INPUT JSON HERE} }` req, err := http.NewRequest("POST", url, bytes.NewBufferString(jsonStr)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+LOGIC_API_TOKEN) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); String json = "{ /* your input JSON here */ }"; RequestBody body = RequestBody.create(json, MediaType.get("application/json")); HttpUrl url = HttpUrl.parse("https://api.logic.inc/v1/agents/{agent_id}/executions") .newBuilder() .addQueryParameter("execMode", "async") .build(); Request request = new Request.Builder() .url(url) .addHeader("Authorization", "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") .addHeader("Content-Type", "application/json") .post(body) .build(); try (Response response = client.newCall(request).execute()) { System.out.println(response.body().string()); } } } ``` #### Example Response ```json theme={null} { "id": "ddd36570-bbdc-4ad1-a8d1-58a9de7c8979", "documentId": "0b9ff0a0-aafb-45f5-9b63-67985320fe79", "status": "IN_PROGRESS", "input": { "artistName": "Adele" }, "output": null, "error": null, "cached": false, "source": "API" } ``` > [!NOTE] > > If caching is enabled (`useCache=true`) and a matching prior execution exists, > an async request returns the cached result right away with `status` already > `SUCCESS` and `"cached": true`, rather than `IN_PROGRESS`. ### Step 2: Poll for the result Use the execution `id` from the response to poll the `GET /agent_executions/{id}` endpoint. Keep polling until `status` is `SUCCESS` or `ERROR`. When the execution succeeds, the `output` field contains the agent's result. ```bash curl theme={null} curl 'https://api.logic.inc/v1/agent_executions/{execution_id}' -H "Authorization: Bearer $LOGIC_API_TOKEN" ``` > [!NOTE] > > A `status` of `IN_PROGRESS` means the agent is still running—wait and poll > again. `SUCCESS` means `output` is populated; `ERROR` means the `error` field > explains what went wrong. # Caching Source: https://docs.logic.inc/api-reference/execution-params/caching How to reuse cached results from previous agent executions ## Caching If you run an agent with the same input more than once, you can reuse the result from a previous run instead of executing the agent again. Add the `useCache` query parameter set to `true` to enable this. A previous execution is reused only when the **agent version**, the **tenant ID**, and the **input** all match. When a match is found, the API returns its result immediately, which reduces latency and cost. If no match is found, the agent runs normally and its result becomes available for future cached requests. When a cached result is returned, the response has `"cached": true` and a `cachedDocumentExecutionId` pointing to the original execution that produced it. > [!NOTE] > > Caching is disabled by default. You can also enable it per agent version in > the execution config; the `useCache` query parameter overrides that persisted > setting for a single call. Use it when the same input reliably produces the > same output and you want to avoid re-running the agent. ### Example with `useCache` Add the `useCache` query parameter to your execution request. ```bash curl theme={null} curl -X POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?useCache=true' -H "Authorization: Bearer $LOGIC_API_TOKEN" -H "Content-Type: application/json" -d '{ {YOUR INPUT JSON HERE} }' ``` ```bash httpie theme={null} http POST 'https://api.logic.inc/v1/agents/{agent_id}/executions' useCache==true "Authorization:Bearer $LOGIC_API_TOKEN" "Content-Type:application/json" --raw '{ {YOUR INPUT JSON HERE} }' ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" response = requests.post( "https://api.logic.inc/v1/agents/{agent_id}/executions", params={"useCache": "true"}, headers={ "Authorization": f"Bearer {LOGIC_API_TOKEN}", "Content-Type": "application/json", }, json={ # Add your agent input here }, ) print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/executions') uri.query = URI.encode_www_form({ useCache: "true" }) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' headers = { "Authorization" => "Bearer #{LOGIC_API_TOKEN}", "Content-Type" => "application/json" } body = { }.to_json request = Net::HTTP::Post.new(uri, headers) request.body = body response = http.request(request) puts response.code puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const url = new URL("https://api.logic.inc/v1/agents/{agent_id}/executions"); url.searchParams.set("useCache", "true"); const response = await fetch(url, { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ // Add your agent input here }), }); console.log(await response.json()); ``` ```go go theme={null} package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { url := "https://api.logic.inc/v1/agents/{agent_id}/executions?useCache=true" jsonStr := `{ {YOUR INPUT JSON HERE} }` req, err := http.NewRequest("POST", url, bytes.NewBufferString(jsonStr)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+LOGIC_API_TOKEN) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); String json = "{ /* your input JSON here */ }"; RequestBody body = RequestBody.create(json, MediaType.get("application/json")); HttpUrl url = HttpUrl.parse("https://api.logic.inc/v1/agents/{agent_id}/executions") .newBuilder() .addQueryParameter("useCache", "true") .build(); Request request = new Request.Builder() .url(url) .addHeader("Authorization", "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") .addHeader("Content-Type", "application/json") .post(body) .build(); try (Response response = client.newCall(request).execute()) { System.out.println(response.body().string()); } } } ``` # Dynamic Learning Source: https://docs.logic.inc/api-reference/execution-params/dynamic-learning How Logic uses previous executions to improve future ones. ## Dynamic Learning Logic can improve future executions based on past ones using dynamic learning. When enabled, Logic can learn from your previous executions - such as the kinds of recommendations, outputs, or patterns that performed well - and apply that knowledge to improve future responses. ## How to use Dynamic Learning To enable dynamic learning for an agent execution, add the `useDynamicLearning` query parameter to your request URL. The value of this parameter can be `true` or `false`. If omitted, dynamic learning is disabled by default. ### Example with `useDynamicLearning` Here’s how to enable dynamic learning in different environments. ```bash curl theme={null} curl -X POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true' -H "Authorization: Bearer $LOGIC_API_TOKEN" -H "Content-Type: application/json" -d '{ /* your input JSON here */ }' ``` ```bash httpie theme={null} http -A bearer -a $LOGIC_API_TOKEN POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true' --raw '{ {YOUR INPUT JSON HERE} }' ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" headers = { "Authorization": f"Bearer {LOGIC_API_TOKEN}", "Content-Type": "application/json" } response = requests.post( "https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true", headers=headers, json={ # Your input fields here } ) print(response.json()) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == 'https' LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Post.new(uri) request['Authorization'] = "Bearer #{LOGIC_API_TOKEN}" request['Content-Type'] = 'application/json' request.body = '{ /* your input here */ }' response = http.request(request) puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const response = await fetch( "https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true", { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ // Your input fields here }), }, ); const data = await response.json(); console.log(data); ``` ```go go theme={null} package main import ( "bytes" "encoding/json" "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { jsonStr := `{ {YOUR INPUT JSON HERE} }` // Create request req, err := http.NewRequest("POST", "https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true", bytes.NewBufferString(jsonStr)) if err != nil { panic(err) } // Add headers req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) // Send request client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() // Read response body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class ApiClient { private static final String LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; public static void main(String[] args) { OkHttpClient client = new OkHttpClient(); MediaType JSON = MediaType.get("application/json; charset=utf-8"); String jsonBody = """ { {YOUR INPUT JSON HERE} } """; RequestBody body = RequestBody.create(jsonBody, JSON); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true") .post(body) .addHeader("Authorization", "Bearer " + LOGIC_API_TOKEN) .addHeader("Content-Type", "application/json") .build(); try (Response response = client.newCall(request).execute()) { String responseBody = response.body().string(); System.out.println(responseBody); } catch (IOException e) { e.printStackTrace(); } } } ``` > [!NOTE] > > Replace any **\{id}** in the example code, such as **\{agent\_id}** with the ID you need for your specific API call. ## How to Isolate Dynamic Learning to a Specific Tenant If you support multiple tenants or customers, you can scope learning behavior per tenant by adding a tenantId parameter. > [!NOTE] > > Learn more about how to use the `tenantId` parameter in the [Tenant > ID](/api-reference/execution-params/tenant-id) section. # Max Agent Steps Source: https://docs.logic.inc/api-reference/execution-params/max-agent-steps How to cap the number of steps an agent takes during an execution ## Max Agent Steps When an agent uses tools, it works in steps: each response from the model counts as one step, whether it returns a message, a single tool call, or several tool calls at once. The `maxAgentSteps` query parameter lets you override the maximum number of steps allowed for a single execution. The value must be an integer from `1` to `500`. If you don't set it, the execution defaults to `100` steps. A value outside that range returns a `400` error rather than being clamped. > [!NOTE] > > This is most relevant for agentic agents that call tools. Lowering the limit > can cap latency and cost; raising it gives complex, multi-step tasks more room > to complete. ### Example with `maxAgentSteps` Add the `maxAgentSteps` query parameter to your execution request. ```bash curl theme={null} curl -X POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?maxAgentSteps=25' -H "Authorization: Bearer $LOGIC_API_TOKEN" -H "Content-Type: application/json" -d '{ {YOUR INPUT JSON HERE} }' ``` ```bash httpie theme={null} http POST 'https://api.logic.inc/v1/agents/{agent_id}/executions' maxAgentSteps==25 "Authorization:Bearer $LOGIC_API_TOKEN" "Content-Type:application/json" --raw '{ {YOUR INPUT JSON HERE} }' ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" response = requests.post( "https://api.logic.inc/v1/agents/{agent_id}/executions", params={"maxAgentSteps": 25}, headers={ "Authorization": f"Bearer {LOGIC_API_TOKEN}", "Content-Type": "application/json", }, json={ # Add your agent input here }, ) print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/executions') uri.query = URI.encode_www_form({ maxAgentSteps: 25 }) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' headers = { "Authorization" => "Bearer #{LOGIC_API_TOKEN}", "Content-Type" => "application/json" } body = { }.to_json request = Net::HTTP::Post.new(uri, headers) request.body = body response = http.request(request) puts response.code puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const url = new URL("https://api.logic.inc/v1/agents/{agent_id}/executions"); url.searchParams.set("maxAgentSteps", "25"); const response = await fetch(url, { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ // Add your agent input here }), }); console.log(await response.json()); ``` ```go go theme={null} package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { url := "https://api.logic.inc/v1/agents/{agent_id}/executions?maxAgentSteps=25" jsonStr := `{ {YOUR INPUT JSON HERE} }` req, err := http.NewRequest("POST", url, bytes.NewBufferString(jsonStr)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+LOGIC_API_TOKEN) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); String json = "{ /* your input JSON here */ }"; RequestBody body = RequestBody.create(json, MediaType.get("application/json")); HttpUrl url = HttpUrl.parse("https://api.logic.inc/v1/agents/{agent_id}/executions") .newBuilder() .addQueryParameter("maxAgentSteps", "25") .build(); Request request = new Request.Builder() .url(url) .addHeader("Authorization", "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") .addHeader("Content-Type", "application/json") .post(body) .build(); try (Response response = client.newCall(request).execute()) { System.out.println(response.body().string()); } } } ``` # Model Override Source: https://docs.logic.inc/api-reference/execution-params/model-override How to specify a custom model when executing an agent ## Model Override By default, Logic automatically routes your agent execution to the optimal model based on your agent's requirements. However, you can bypass this routing and explicitly specify which model and reasoning level to use by adding the `model` query parameter. > [!WARNING] > > Model overrides are an advanced feature. In most cases, Logic's automatic > model routing will select the best model for your use case. Only use model > overrides when you have specific requirements around model selection. ## Available Models The `model` parameter accepts a model identifier in the format `{model}:{reasoning_level}`. | Provider | Model Overrides | | - | - | | OpenAI GPT-5.1 | `gpt-5.1:none`, `gpt-5.1:minimal`, `gpt-5.1:low`, `gpt-5.1:medium`, `gpt-5.1:high` | | OpenAI GPT-5.2 | `gpt-5.2:none`, `gpt-5.2:minimal`, `gpt-5.2:low`, `gpt-5.2:medium`, `gpt-5.2:high` | | OpenAI GPT-5.4 | `gpt-5.4:none`, `gpt-5.4:minimal`, `gpt-5.4:low`, `gpt-5.4:medium`, `gpt-5.4:high` | | OpenAI GPT-5.5 | `gpt-5.5:none`, `gpt-5.5:minimal`, `gpt-5.5:low`, `gpt-5.5:medium`, `gpt-5.5:high` | | Gemini 3 Flash | `gemini-3-flash:default`, `gemini-3-flash:low`, `gemini-3-flash:medium`, `gemini-3-flash:high` | | Gemini 3.1 Pro | `gemini-3.1-pro:default`, `gemini-3.1-pro:low`, `gemini-3.1-pro:high` | | Groq | `groq-gpt-oss:default` | | Cerebras | `cerebras-gpt-oss:default`, `cerebras-gpt-oss:low`, `cerebras-gpt-oss:medium`, `cerebras-gpt-oss:high` | ### Reasoning Levels The reasoning level controls how much "thinking" the model does before responding: * **none/default** — Standard response without extended reasoning * **minimal** — Light reasoning for simple tasks * **low** — Basic reasoning for straightforward problems * **medium** — Moderate reasoning for complex tasks * **high** — Maximum reasoning for the most challenging problems > [!NOTE] > > Higher reasoning levels may increase latency and cost but can improve accuracy > for complex tasks. ## Capability Validation When using a model override, Logic validates that your chosen model supports your agent's requirements. If your agent requires capabilities the model doesn't support, you'll receive a `400 InvalidModelOverride` error. | Capability | OpenAI | Gemini | Groq | Cerebras | | - | - | - | - | - | | PDF Processing | Supported | Supported | Not supported | Not supported | | Office Documents | Supported | Supported | Not supported | Not supported | | Image Processing | Supported | Supported | Not supported | Not supported | | Audio Processing | Not supported | Supported | Not supported | Not supported | | HIPAA Compliance | Not supported | Supported | Not supported | Not supported | | Tool Usage | Supported | Not supported | Supported | Supported | For example, if your agent processes audio input and you specify `?model=gpt-5.1:low`, the request will fail because OpenAI models don't support audio processing. ## Example Usage Below are examples showing how to specify a model override when executing an agent. ```bash curl theme={null} curl -X POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?model=gpt-5.1:low' -H "Authorization: Bearer $LOGIC_API_TOKEN" -H "Content-Type: application/json" -d '{ /* your input JSON here */ }' ``` ```bash httpie theme={null} http -A bearer -a $LOGIC_API_TOKEN POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?model=gpt-5.1:low' --raw '{ {YOUR INPUT JSON HERE} }' ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" headers = { "Authorization": f"Bearer {LOGIC_API_TOKEN}", "Content-Type": "application/json" } response = requests.post( "https://api.logic.inc/v1/agents/{agent_id}/executions?model=gpt-5.1:low", headers=headers, json={ # Your input fields here } ) print(response.json()) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/executions?model=gpt-5.1:low') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == 'https' LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Post.new(uri) request['Authorization'] = "Bearer #{LOGIC_API_TOKEN}" request['Content-Type'] = 'application/json' request.body = '{ /* your input here */ }' response = http.request(request) puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const response = await fetch( "https://api.logic.inc/v1/agents/{agent_id}/executions?model=gpt-5.1:low", { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ // Your input fields here }), }, ); const data = await response.json(); console.log(data); ``` ```go go theme={null} package main import ( "bytes" "encoding/json" "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { jsonStr := `{ {YOUR INPUT JSON HERE} }` // Create request req, err := http.NewRequest("POST", "https://api.logic.inc/v1/agents/{agent_id}/executions?model=gpt-5.1:low", bytes.NewBufferString(jsonStr)) if err != nil { panic(err) } // Add headers req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) // Send request client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() // Read response body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class ApiClient { private static final String LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; public static void main(String[] args) { OkHttpClient client = new OkHttpClient(); MediaType JSON = MediaType.get("application/json; charset=utf-8"); String jsonBody = """ { // Your input fields here } """; RequestBody body = RequestBody.create(jsonBody, JSON); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/{agent_id}/executions?model=gpt-5.1:low") .post(body) .addHeader("Authorization", "Bearer " + LOGIC_API_TOKEN) .addHeader("Content-Type", "application/json") .build(); try (Response response = client.newCall(request).execute()) { String responseBody = response.body().string(); System.out.println(responseBody); } catch (IOException e) { e.printStackTrace(); } } } ``` ## Error Handling If you specify an invalid model or a model that doesn't support your agent's requirements, you'll receive a `400 InvalidModelOverride` error: ```json theme={null} { "error": { "code": "InvalidModelOverride", "message": "The specified model 'gpt-5.1:low' does not support audio processing required by this agent" } } ``` # Strict Mode Source: https://docs.logic.inc/api-reference/execution-params/strict-mode How to use strict mode when executing an agent ## Strict Mode By default, if you send input that doesn't strictly match the input schema, the Logic API will try to make sense of it anyway. This improves backward compatibility: if your input shape changes over time, the Logic API will adapt instead of throwing an error. If you want to run the agent in strict mode, which means it will error if the input data does not precisely match the input schema, you can add the query parameter `?enforceInputSchema=true` to your call. > [!NOTE] > > Note: This only impacts input data. The output data will always match the > output schema. ### Examples of Strict Mode on and off For an agent that takes an input schema of: ```json theme={null} { "artistName": { "type": "string", "description": "The name of the artist." } } ``` #### Strict Mode Off Strict mode off would accept a slightly incorrect input, like `artistName` being `artist-name` Below are examples of calling this agent with strict mode **off**, using input that doesn't fit the schema but will still be accepted. ```bash curl theme={null} curl -X POST 'https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions' -H "Authorization: Bearer $LOGIC_API_TOKEN" -H "Content-Type: application/json" -d '{ "artist-name": "Adele" }' ``` ```bash httpie theme={null} http POST https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions "Authorization:Bearer $LOGIC_API_TOKEN" "Content-Type:application/json" artist-name="Adele" ``` ```python python theme={null} import requests import json url = "https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions" headers = { "Authorization": "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "Content-Type": "application/json" } data = { "artist-name": "Adele" } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' headers = { "Authorization" => "Bearer #{LOGIC_API_TOKEN}", "Content-Type" => "application/json" } body = { "artist-name" => "Adele" }.to_json request = Net::HTTP::Post.new(uri, headers) request.body = body response = http.request(request) puts response.code puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; fetch( "https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions", { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ "artist-name": "Adele" }), }, ) .then((res) => res.text()) .then(console.log) .catch(console.error); ``` ```go go theme={null} package main import ( "bytes" "encoding/json" "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { url := "https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions" body := map[string]string{ "artist-name": "Adele", } jsonData, _ := json.Marshal(body) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() responseBody, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(responseBody)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); String json = "{\"artist-name\": \"Adele\"}"; RequestBody body = RequestBody.create(json, MediaType.get("application/json")); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions") .addHeader("Authorization", "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") .addHeader("Content-Type", "application/json") .post(body) .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { System.err.println("Request failed: " + response.code()); return; } System.out.println(response.body().string()); } } } ``` > [!NOTE] > > This would succeed, as strict mode is off by default. > > Even though the input variable is supposed to be called `artistName`, the Logic API will adapt to the input and return a response. #### Strict Mode On The same request fails when strict mode is **on**, because the input doesn't match the schema. ```bash curl theme={null} curl -X POST 'https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions?enforceInputSchema=true' -H "Authorization: Bearer $LOGIC_API_TOKEN" -H "Content-Type: application/json" -d '{ "artist-name": "Adele" }' ``` ```bash httpie theme={null} http POST https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions enforceInputSchema==true "Authorization:Bearer $LOGIC_API_TOKEN" "Content-Type:application/json" artist-name="Adele" ``` ```python python theme={null} import requests import json url = "https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions" params = { "enforceInputSchema": "true" } headers = { "Authorization": "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "Content-Type": "application/json" } data = { "artist-name": "Adele" } response = requests.post(url, params=params, headers=headers, data=json.dumps(data)) print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions') uri.query = URI.encode_www_form({enforceInputSchema: "true" }) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' headers = { "Authorization" => "Bearer #{LOGIC_API_TOKEN}", "Content-Type" => "application/json" } body = { "artist-name" => "Adele" }.to_json request = Net::HTTP::Post.new(uri, headers) request.body = body response = http.request(request) puts response.code puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const url = new URL( "https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions", ); url.searchParams.set("enforceInputSchema", "true"); fetch(url, { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ "artist-name": "Adele" }), }) .then((res) => res.text()) .then(console.log) .catch(console.error); ``` ```go go theme={null} package main import ( "bytes" "encoding/json" "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { url := "https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions?enforceInputSchema=true" body := map[string]string{ "artist-name": "Adele", } jsonData, _ := json.Marshal(body) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+LOGIC_API_TOKEN) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() responseBody, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(responseBody)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); String json = "{\"artist-name\": \"Adele\"}"; RequestBody body = RequestBody.create(json, MediaType.get("application/json")); HttpUrl url = HttpUrl.parse("https://api.logic.inc/v1/agents/summarize-music-artist-profile/executions") .newBuilder() .addQueryParameter("enforceInputSchema", "true") .build(); Request request = new Request.Builder() .url(url) .addHeader("Authorization", "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") .addHeader("Content-Type", "application/json") .post(body) .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { System.err.println("Request failed: " + response.code()); return; } System.out.println(response.body().string()); } } } ``` > [!NOTE] > > This would fail, as strict mode is on and the input does not match the input schema. > > The Logic API will not adapt to the input and will return an error. # Tenant ID Source: https://docs.logic.inc/api-reference/execution-params/tenant-id How to handle customer-specific data in Logic. ## Tenant ID The Logic API supports [multitenancy](https://en.wikipedia.org/wiki/Multitenancy), allowing you to separate data and behavior for each of your customers. By including a `tenantId` in your request, you tell Logic which customer the execution belongs to. Logic will keep data, learning, and behavior isolated for each `tenantId`, ensuring that one customer's data is never used to influence another's. Even if you're not using dynamic learning yet, you can include a `tenantId` in your executions. That way, if you enable dynamic learning later, it will automatically stay isolated per tenant. > [!NOTE] > > Learn more about the Logic's dynamic learning in the [Dynamic > Learning](/api-reference/execution-params/dynamic-learning) section. ## Isolating Dynamic Learning with `tenantId` When using dynamic learning, you can isolate the learning process by specifying a `tenantId` parameter. This allows you to test and evaluate the impact of dynamic learning on different sets of executions without affecting the overall learning process. This is especially useful when serving multiple tenants, as it ensures each one's learning data remains isolated. ### Example with `useDynamicLearning` & `tenantId` Below are example requests using both `useDynamicLearning=true` and `tenantId` to isolate learning for a specific customer. ```bash curl theme={null} curl -X POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true&tenantId={tenant_id}' -H "Authorization: Bearer $LOGIC_API_TOKEN" -H "Content-Type: application/json" -d '{ /* your input JSON here */ }' ``` ```bash httpie theme={null} http -A bearer -a $LOGIC_API_TOKEN POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true&tenantId={tenant_id}' --raw '{ {YOUR INPUT JSON HERE} }' ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" headers = { "Authorization": f"Bearer {LOGIC_API_TOKEN}", "Content-Type": "application/json" } response = requests.post( "https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true&tenantId={tenant_id}", headers=headers, json={ # Add your agent input here } ) print(response.json()) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true&tenantId={tenant_id}') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == 'https' LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Post.new(uri) request['Authorization'] = "Bearer #{LOGIC_API_TOKEN}" request['Content-Type'] = 'application/json' request.body = ' { {YOUR INPUT JSON HERE} } ' response = http.request(request) puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const response = await fetch( "https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true&tenantId={tenant_id}", { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ // Add your agent input here }), }, ); const data = await response.json(); console.log(data); ``` ```go go theme={null} package main import ( "bytes" "encoding/json" "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { jsonStr := `{ {YOUR INPUT JSON HERE} }` // Create request req, err := http.NewRequest("POST", "https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true&tenantId={tenant_id}", bytes.NewBufferString(jsonStr)) if err != nil { panic(err) } // Add headers req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) // Send request client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() // Read response body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class ApiClient { private static final String LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; public static void main(String[] args) { OkHttpClient client = new OkHttpClient(); MediaType JSON = MediaType.get("application/json; charset=utf-8"); String jsonBody = """ { {YOUR INPUT JSON HERE} } """; RequestBody body = RequestBody.create(jsonBody, JSON); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/{agent_id}/executions?useDynamicLearning=true&tenantId={tenant_id}") .post(body) .addHeader("Authorization", "Bearer " + LOGIC_API_TOKEN) .addHeader("Content-Type", "application/json") .build(); try (Response response = client.newCall(request).execute()) { String responseBody = response.body().string(); System.out.println(responseBody); } catch (IOException e) { e.printStackTrace(); } } } ``` # Version Source: https://docs.logic.inc/api-reference/execution-params/version How to specify the version of an agent you want to call. ## Version Every time you publish an agent in Logic, a new version of that agent is created. This allows you to keep track of changes and improvements made to the agent over time. Each version has a unique version ID that can be used to reference it. > [!NOTE] > > Learn more about agent versions in the [Spec > History](/guides/versions-and-history/spec-history) section. When you make an agent execution, you can specify the version of the agent you want to call. This is useful when you need to call a specific version of an agent after it has been updated. To specify the version of an agent, you can add the `version` parameter to the URL of the execution request. The parameter should be set to the version ID you want to use. ## How to Find the Version ID of an Agent ![agent-versions](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_versions.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=1a160c1fe5ab28528b99c71dfb321520) You can find the version ID of an agent in the Logic API dashboard. Each agent has a list of versions, and you can select the version you want to use. You can also use the Logic API to list all versions of an agent using the `GET /agents/{id}/versions` endpoint. This will return a list of all versions of the agent, along with their version IDs. ### Example with `version` Below are examples in several languages showing how to specify the version when calling an agent execution. ```bash curl theme={null} curl -X POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?version={version_id}' -H "Authorization: Bearer $LOGIC_API_TOKEN" -H "Content-Type: application/json" -d '{ /* your input JSON here */ }' ``` ```bash httpie theme={null} http -A bearer -a $LOGIC_API_TOKEN POST 'https://api.logic.inc/v1/agents/{agent_id}/executions?version={version_id}' --raw '{ {YOUR INPUT JSON HERE} }' ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" headers = { "Authorization": f"Bearer {LOGIC_API_TOKEN}", "Content-Type": "application/json" } response = requests.post( "https://api.logic.inc/v1/agents/{agent_id}/executions?version={version_id}", headers=headers, json={ # Your input fields here } ) print(response.json()) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/executions?version={version_id}') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == 'https' LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Post.new(uri) request['Authorization'] = "Bearer #{LOGIC_API_TOKEN}" request['Content-Type'] = 'application/json' request.body = '{ /* your input here */ }' response = http.request(request) puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const response = await fetch( "https://api.logic.inc/v1/agents/{agent_id}/executions?version={version_id}", { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ // Your input fields here }), }, ); const data = await response.json(); console.log(data); ``` ```go go theme={null} package main import ( "bytes" "encoding/json" "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { jsonStr := `{ {YOUR INPUT JSON HERE} }` // Create request req, err := http.NewRequest("POST", "https://api.logic.inc/v1/agents/{agent_id}/executions?version={version_id}", bytes.NewBufferString(jsonStr)) if err != nil { panic(err) } // Add headers req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) // Send request client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() // Read response body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class ApiClient { private static final String LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; public static void main(String[] args) { OkHttpClient client = new OkHttpClient(); MediaType JSON = MediaType.get("application/json; charset=utf-8"); String jsonBody = """ { // Your input fields here } """; RequestBody body = RequestBody.create(jsonBody, JSON); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/{agent_id}/executions?version={version_id}") .post(body) .addHeader("Authorization", "Bearer " + LOGIC_API_TOKEN) .addHeader("Content-Type", "application/json") .build(); try (Response response = client.newCall(request).execute()) { String responseBody = response.body().string(); System.out.println(responseBody); } catch (IOException e) { e.printStackTrace(); } } } ``` # Past Agent Executions Source: https://docs.logic.inc/api-reference/executions/agent-executions How to read and delete past agent executions ## Agent Executions An agent execution represents a single run of an agent—including the time it ran, its status, and the input/output. You can review agent executions to monitor how your agent has been used over time. ### Get Agent Executions To get the agent executions for all your agents, you can use the `GET /agent_executions/` endpoint. #### Example for All Agents ```bash curl theme={null} curl https://api.logic.inc/v1/agent_executions/ -H "Authorization: Bearer $LOGIC_API_TOKEN" ``` ```bash httpie theme={null} http GET https://api.logic.inc/v1/agent_executions/ "Authorization:Bearer $LOGIC_API_TOKEN" ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" headers = { "Authorization": f"Bearer {LOGIC_API_TOKEN}" } response = requests.get("https://api.logic.inc/v1/agent_executions/", headers=headers) print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'uri' uri = URI('https://api.logic.inc/v1/agent_executions/') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{LOGIC_API_TOKEN}" response = http.request(request) puts response.code puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; fetch("https://api.logic.inc/v1/agent_executions/", { headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, }, }) .then((res) => res.text()) .then(console.log) .catch(console.error); ``` ```go go theme={null} package main import ( "fmt" "io/ioutil" "net/http" ) const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" func main() { url := "https://api.logic.inc/v1/agent_executions/" req, err := http.NewRequest("GET", url, nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agent_executions/") .addHeader("Authorization", "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { System.err.println("Request failed: " + response.code()); return; } System.out.println(response.body().string()); } } } ``` > [!NOTE] > > This will return a list of all the executions for the agents in your > organization. ### List All Agent Executions for a Specific Agent To get the agent executions for a specific agent, you can use the `GET /agents/{agent_id}/executions` endpoint. This will return a list of all the executions for the specified agent. You can learn more about how to get the agent ID in the [Agent IDs](/api-reference/agents/agent-id) section. #### Example for a Specific Agent ```bash curl theme={null} curl https://api.logic.inc/v1/agents/{agent_id}/executions/ -H "Authorization: Bearer $LOGIC_API_TOKEN" ``` ```bash httpie theme={null} http GET https://api.logic.inc/v1/agents/{agent_id}/executions/ "Authorization:Bearer $LOGIC_API_TOKEN" ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" headers = { "Authorization": f"Bearer {LOGIC_API_TOKEN}" } response = requests.get("https://api.logic.inc/v1/agents/{agent_id}/executions/", headers=headers) print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'uri' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/executions/') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{LOGIC_API_TOKEN}" response = http.request(request) puts response.code puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; fetch("https://api.logic.inc/v1/agents/{agent_id}/executions/", { headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, }, }) .then((res) => res.text()) .then(console.log) .catch(console.error); ``` ```go go theme={null} package main import ( "fmt" "io/ioutil" "net/http" ) const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" func main() { url := "https://api.logic.inc/v1/agents/{agent_id}/executions/" req, err := http.NewRequest("GET", url, nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/{agent_id}/executions/") .addHeader("Authorization", "Bearer ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { System.err.println("Request failed: " + response.code()); return; } System.out.println(response.body().string()); } } } ``` > [!NOTE] > > This will return a list of all the executions for a specified agent in your > organization. > [!NOTE] > > Replace any **\{id}** in the example code, such as **\{agent\_id}** with the ID you need for your specific API call. # Handling Errors Source: https://docs.logic.inc/api-reference/executions/errors Error handling in the Logic API ## Handling Errors If there is an error in your request, you will receive a response with an `error` field explaining the issue. Ensure your input adheres to the specified schema. ### Example Error Response When calling an agent that summarizes musical artist info with an invalid artist name, you might receive a response like this: ```json theme={null} { "error": { "reason": "LLM_GENERATED_ERROR", "errors": [ "I could not find any information about an artist or band named 'The Mysterious Sound.' Please check the spelling or provide a different artist name." ] }, } ``` The entire response will look like this: ```json theme={null} { "id": "ddd36570-bbdc-4ad1-a8d1-58a9de7c8979", "createdBy": "d8960ff9-b872-4701-ab71-b28325c443f7", "createdAt": "2025-05-01T19:56:26.070Z", "updatedAt": "2025-05-01T19:56:33.180Z", "orgId": "00f04988-958d-442c-9142-bd14399d87b3", "documentId": "0b9ff0a0-aafb-45f5-9b63-67985320fe79", "documentVersionId": "4df0fc7f-0218-4318-ae1e-2fe15e97223f", "promptExecutionId": "7a2b1ee9-6f3d-4f65-9334-3569dded26ed", "status": "ERROR", "input": { "artistName": "The Mysterious Sound" }, "output": null, "error": { "reason": "LLM_GENERATED_ERROR", "errors": [ "I could not find any information about an artist or band named 'The Mysterious Sound.' Please check the spelling or provide a different artist name." ] }, "source": "API", "tenantId": null, "executionDurationMs": 7109.575 } ``` # Executing an Agent Source: https://docs.logic.inc/api-reference/executions/executing How to execute an agent using the Logic API ## Executing an Agent Use the `POST /agents/{id}/executions` endpoint to run an agent with input and receive the output. > [!NOTE] > > Want to customize agent executions? You can add optional parameters like: - > [Dynamic Learning](/api-reference/execution-params/dynamic-learning) — enable > learning from past executions - [Tenant > ID](/api-reference/execution-params/tenant-id) — isolate learning per customer > > * [Strict Mode](/api-reference/execution-params/strict-mode) — validate input > strictly against schema - > [Versioning](/api-reference/execution-params/version) — execute a specific > version of an agent - > [Model Override](/api-reference/execution-params/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. > [!NOTE] > > Learn more about authorization and how to set up your API token in the [Authorization section](/api-reference/authorization). ## 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. ```bash curl theme={null} 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} }' ``` ```bash httpie theme={null} http -A bearer -a $LOGIC_API_TOKEN POST 'https://api.logic.inc/v1/agents/{agent_id}/executions' --raw '{ {YOUR INPUT JSON HERE} }' ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" headers = { "Authorization": f"Bearer {LOGIC_API_TOKEN}", "Content-Type": "application/json" } response = requests.post( "https://api.logic.inc/v1/agents/{agent_id}/executions", headers=headers, json={ {YOUR INPUT JSON HERE} } ) print(response.json()) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/{agent_id}/executions') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == 'https' LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Post.new(uri) request['Authorization'] = "Bearer #{LOGIC_API_TOKEN}" request['Content-Type'] = 'application/json' request.body = ' { {YOUR INPUT JSON HERE} } ' response = http.request(request) puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const response = await fetch( "https://api.logic.inc/v1/agents/{agent_id}/executions", { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ // Add your agent input here }), }, ); const data = await response.json(); console.log(data); ``` ```go go theme={null} package main import ( "bytes" "encoding/json" "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { jsonStr := `{ {YOUR INPUT JSON HERE} }` // Create request req, err := http.NewRequest("POST", "https://api.logic.inc/v1/agents/{agent_id}/executions", bytes.NewBufferString(jsonStr)) if err != nil { panic(err) } // Add headers req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) // Send request client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() // Read response body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class ApiClient { private static final String LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; public static void main(String[] args) { OkHttpClient client = new OkHttpClient(); MediaType JSON = MediaType.get("application/json; charset=utf-8"); String jsonBody = """ { {YOUR INPUT JSON HERE} } """; RequestBody body = RequestBody.create(jsonBody, JSON); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/{agent_id}/executions") .post(body) .addHeader("Authorization", "Bearer " + LOGIC_API_TOKEN) .addHeader("Content-Type", "application/json") .build(); try (Response response = client.newCall(request).execute()) { String responseBody = response.body().string(); System.out.println(responseBody); } catch (IOException e) { e.printStackTrace(); } } } ``` > [!NOTE] > > Replace any **\{id}** in the example code, such as **\{agent\_id}** with the ID you need for your specific API call. > [!NOTE] > > Replace `{YOUR INPUT JSON HERE}` with the correct input for your agent. You can find the required fields in your agent’s [Input Schema](/api-reference/agents/input-schemas). ## 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. ```bash curl theme={null} 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." }' ``` ```bash httpie theme={null} http -A bearer -a $LOGIC_API_TOKEN POST 'https://api.logic.inc/v1/agents/d0844039-9f16-40ba-b93e-405f043ef88a/executions' --raw '{ "content": "Steve emailed me at my personal address: mary@yahoo.com." }' ``` ```python python theme={null} import requests LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" headers = { "Authorization": f"Bearer {LOGIC_API_TOKEN}", "Content-Type": "application/json" } response = requests.post( "https://api.logic.inc/v1/agents/d0844039-9f16-40ba-b93e-405f043ef88a/executions", headers=headers, json={ "content": "Steve emailed me at my personal address: mary@yahoo.com." } ) print(response.json()) ``` ```ruby ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.logic.inc/v1/agents/d0844039-9f16-40ba-b93e-405f043ef88a/executions') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == 'https' LOGIC_API_TOKEN = 'ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request = Net::HTTP::Post.new(uri) request['Authorization'] = "Bearer #{LOGIC_API_TOKEN}" request['Content-Type'] = 'application/json' request.body = ' { "content": "Steve emailed me at my personal address: mary@yahoo.com." } ' response = http.request(request) puts response.body ``` ```javascript javascript theme={null} const LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const response = await fetch( "https://api.logic.inc/v1/agents/d0844039-9f16-40ba-b93e-405f043ef88a/executions", { method: "POST", headers: { Authorization: `Bearer ${LOGIC_API_TOKEN}`, "Content-Type": "application/json", }, body: '{\ "content": "Steve emailed me at my personal address: mary@yahoo.com."\ }', }, ); const data = await response.json(); console.log(data); ``` ```go go theme={null} package main import ( "bytes" "encoding/json" "fmt" "net/http" "io/ioutil" ) const ( LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) func main() { jsonStr := `{ "content": "Steve emailed me at my personal address: mary@yahoo.com." }` // Create request req, err := http.NewRequest("POST", "https://api.logic.inc/v1/agents/d0844039-9f16-40ba-b93e-405f043ef88a/executions", bytes.NewBufferString(jsonStr)) if err != nil { panic(err) } // Add headers req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer " + LOGIC_API_TOKEN) // Send request client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() // Read response body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class ApiClient { private static final String LOGIC_API_TOKEN = "ls-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; public static void main(String[] args) { OkHttpClient client = new OkHttpClient(); MediaType JSON = MediaType.get("application/json; charset=utf-8"); String jsonBody = """ { "content": "Steve emailed me at my personal address: mary@yahoo.com." } """; RequestBody body = RequestBody.create(jsonBody, JSON); Request request = new Request.Builder() .url("https://api.logic.inc/v1/agents/d0844039-9f16-40ba-b93e-405f043ef88a/executions") .post(body) .addHeader("Authorization", "Bearer " + LOGIC_API_TOKEN) .addHeader("Content-Type", "application/json") .build(); try (Response response = client.newCall(request).execute()) { String responseBody = response.body().string(); System.out.println(responseBody); } catch (IOException e) { e.printStackTrace(); } } } ``` > [!NOTE] > > This agent redacts PII from a block of text. Your agent may expect different input—refer to its input schema for details. ### Example Response ```json theme={null} { "redactedText": "{{ name }} emailed me at my personal address: {{ email }}.", "redactedEntities": ["Steve", "mary@yahoo.com"] } ``` # Introduction to the Logic API Source: https://docs.logic.inc/api-reference/introduction Welcome to the Logic API documentation ![Hero Light](https://mintcdn.com/logic/YO7O6hkpncKkRwwK/images/hero-light.png?fit=max\&auto=format\&n=YO7O6hkpncKkRwwK\&q=85\&s=b3d99a02b374f38b988313e05a390b4d) ## Welcome Welcome to the Logic API documentation! Here you can find everything you need to get started with the Logic API, including descriptions of the API endpoints, example requests and responses, and more. To find documentation on general Logic usage, visit the [Guides](/guides) section. ### Languages The Logic API documentation is available in multiple languages, including: cURL, HTTPie, Python, Ruby, JavaScript, Go, and Java ### Getting Started To get started with the Logic API, begin with the [Quick Start](/api-reference/quick-start) section. This section will guide you through the process of making your first API call, including how to create an API key, get the ID of your agent, and execute your agent using the API. # Healthcheck Source: https://docs.logic.inc/api-reference/other/healthcheck How to check your connection to the Logic server ## Logic Server Status Logic provides multiple ways to check the status of its servers. You can check the status of the Logic API server via the API healthcheck endpoint, or you can check the status of the Logic platform via the [Logic Status Page](https://status.logic.inc). ### Status Website ![Logic Status Page](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/status_page.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=f54d73db4fd08209b9656036cea2c5ee) For more detailed information about the status of the server, you can check the [Logic Status Page](https://status.logic.inc). This page provides real-time information about the status of the Logic API and any ongoing incidents or maintenance. The Logic Status Page will show you the current status of Logic's services, including the API and the dashboard. It will also provide information about any ongoing incidents or maintenance that may affect the performance of the Logic platform. ### Healthcheck The healthcheck endpoint is used to check the connection to the Logic server. It returns a 200 OK response if the server is reachable and functioning properly. It can be useful for troubleshooting API issues. If you get a `200 OK` response, it means that the server is up and running, and you are able to reach it. If you get a different response, it may indicate that there is a problem with the server or your connection to it. You can run the healthcheck command by executing the following in your terminal: ```bash curl theme={null} curl -X GET https://api.logic.inc/v1/healthcheck ``` ```bash httpie theme={null} http GET https://api.logic.inc/v1/healthcheck ``` ```python python theme={null} import requests response = requests.get("https://api.logic.inc/v1/healthcheck") print(response.status_code, response.text) ``` ```ruby ruby theme={null} require 'net/http' require 'uri' uri = URI('https://api.logic.inc/v1/healthcheck') response = Net::HTTP.get_response(uri) puts response.code puts response.body ``` ```javascript javascript theme={null} fetch("https://api.logic.inc/v1/healthcheck") .then((res) => res.text()) .then(console.log) .catch(console.error); ``` ```go go theme={null} package main import ( "fmt" "io/ioutil" "net/http" ) func main() { resp, err := http.Get("https://api.logic.inc/v1/healthcheck") if err != nil { panic(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` ```java java theme={null} // Java requires the OkHttp library. You can add it to your project using Maven or Gradle. Learn more in the Java Quick Start section of the API reference. import okhttp3.*; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.logic.inc/v1/healthcheck") .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { System.err.println("Healthcheck failed: " + response.code()); return; } System.out.println(response.body().string()); } } } ``` #### Example Response ```json theme={null} { "success": true } ``` > [!NOTE] > > This API call does not require any authorization or API key. # Java Setup Source: https://docs.logic.inc/api-reference/other/java-setup Java-specific setup for using the Logic API ## Java Setup for Logic API When using Java to interact with the Logic API, you will need to set up your environment and dependencies correctly. Below are the steps to get started. ### How to Configure Your Java Environment Java requires the OkHttp library. You can add it to your project using Maven or Gradle. For Maven, add the following dependency to your `pom.xml`: ```xml theme={null} com.squareup.okhttp3 okhttp 4.9.1 ``` For Gradle, add the following to your `build.gradle`: ```groovy theme={null} implementation 'com.squareup.okhttp3:okhttp:4.9.1' ``` # Quick Start Source: https://docs.logic.inc/api-reference/quick-start How to call the Logic API for the first time ## Quick Start Let's get started with the Logic API! In this guide, we will walk you through the steps to make your first API call. > [!NOTE] > > **Backwards Compatibility:** The `/v1/documents/` endpoints continue to work and are fully supported. `/v1/agents/` is the preferred path going forward. If you have existing integrations using `/v1/documents/`, no changes are required. ### Prerequisites This guide assumes you have access to the Logic dashboard and have already created an agent. If you haven't done this yet, please refer to the [Making a New Agent](/guides/agent-editing/making-agents) section. ### Step 1: Create an API key ![api keys](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/api_keys.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=09b093a90b61c770ace8b3d487797b45) 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. You can create an API key in the [Logic Dashboard API Key Page](https://app.logic.inc/settings/organization-settings/api-keys). > [!NOTE] > > Learn more about how to create your API key in the > [Authorization](/api-reference/authorization) section. ### Step 2: Get the ID of your agent To get the ID of your agent, you can use the `/agents` endpoint. This will return a JSON object containing the ID of your agent, created and updated dates, the slug you can use to refer to it for API requests, and more. > [!NOTE] > > Learn more about how to get the agent ID in the [Agent > IDs](/api-reference/agents/agent-id) section. ### Step 3: Execute your agent using the API To execute your agent using the API, you can use the `/agents/{agent_id}/executions` endpoint. This will return a JSON object containing the output of your agent. > [!NOTE] > > Learn more about how to execute your agent in the [Executing an > Agent](/api-reference/executions/executing) section. > [!NOTE] > > If you use Java, there are some additional steps to set up your project. You > can find more information in the [Java Setup](/api-reference/other/java-setup) > section. # Account Settings Source: https://docs.logic.inc/guides/account-settings/account-settings Manage your profile, appearance, and security settings ![account settings](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/account_settings.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=e86c060c9cf1a01e12c06dab175056ca) ## Account Settings The **Account Settings** page lets you manage your personal profile and customize how Logic looks and feels in your browser. ### Profile Your profile displays your name and email address. These details are associated with your Logic account. ### App Theme Choose between a light and dark appearance for the app. This setting applies to your browser immediately and is stored locally. ### Interface Density Control how compact or spacious the interface feels. Two options are available: | Option | Description | | - | - | | **Compact** | Tighter type and spacing for information-dense workflows. | | **Airy** | More generous type and spacing for comfortable reading. | This setting applies to your browser immediately. ### Signing Out To sign out of your Logic account, scroll to the bottom of the Account Settings page and click **Sign Out**. # Authentication Settings Source: https://docs.logic.inc/guides/account-settings/authentication-settings Manage your authentication settings ![authentication settings](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/authentication_settings.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=45d15f5faaf50c6dcb1f19778051ca2d) ## Authentication Settings The **Authentication Settings** page allows you to manage your authentication settings for your Logic account. On this page, you can view information about your account and manage your password. ### Account Information You can view your account details, including your email address and account status. ### Changing Your Password To change your password, click the **Send password reset email** button. When you reset your password: 1. A password reset email will be sent to your registered email address 2. All other active sessions will be automatically revoked 3. Other devices will be signed out and will need to sign in again 4. Your current session will remain active This security measure ensures that if you're resetting your password due to a security concern, all other access points are immediately secured. After receiving the reset email, follow the link provided to create a new password for your account. # Manage Sessions Source: https://docs.logic.inc/guides/account-settings/list-sessions View and manage your active sessions ![list sessions](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/list_sessions.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=bbd8136c61b64d8b6c015d21f0711d7c) ## Account Sessions ### List Sessions The **Sessions** page allows you to view and manage your active sessions across different devices and browsers. You can see information about each session, including the device, browser, and last active time. You can also revoke any active sessions if needed. ### Revoking Sessions To revoke a session, click on the **Revoke** button next to the session you want to end. This will log you out of that session and require you to log in again if you want to access your account from that device or browser. Additionally, you can revoke all sessions by clicking on the **Revoke All** button at the top of the section. This will log you out of all active sessions including the current one, and you will need to log in again to access your account. # Creating and Editing Agents Source: https://docs.logic.inc/guides/agent-editing/creating-and-editing-agents Creating agents manually and editing them in Logic ## Creating an Agent Manually What do you need the Logic API to do? Write a description of the task you want to accomplish. In the example of an image analysis agent, the description might be: ```text theme={null} "Accept an image as a URL or base64-encoded data and tell me what it is. Include items like: - How many people are in it? - What is the dominant color of the image? - What's the general mood it invokes? - What is the gender and or age of the person in the photo?" ``` To provide the Logic API with context, you can also include examples of input and output. ## Editing Your Agent ![agent-editor](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_editor.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=0ad2c2db119428ccb77b78e48451cd46) Once you have created an agent, you can edit it to better fit your needs. This guide will walk you through the steps to edit an agent in Logic. ### Step 1: Access the Logic dashboard Open the [Logic dashboard](https://app.logic.inc) and log in to your account. Select the agent you want to edit from the list of agents. If you have just generated an agent from a description, it will already be opened in the agent editor. ### Step 2: Edit your agent You can now edit the agent to suit your specific use case. Feel free to add, remove, or modify sections as needed. For example, you might include more detail about the image analysis process or add input/output examples. ### Step 3: Use text formatting Within the **Instructions** section you can use text formatting to make your agent more readable. For example, you can use bullet points to list the items you want the Logic API to include in its analysis. You can also use headings to separate different sections of your agent. For example, you might have a section for the input and a section for the output. Formatting options such as headings and lists are available as you edit the instructions, helping you organize your agent and make it easier to read. > [!NOTE] > > If you want to learn more about what makes a good agent, check out the [What > Makes a Good Agent?](/guides/other/making-a-good-agent) section. ## Finishing Your Agent ![agent-list-hover-menu](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_list_hover_menu.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=93d7937fa83441138d6df4de6efbfe98) ### Step 4: Set a title The title is something for you to use to refer to your agent later, so choose something descriptive. You can edit the title directly in the agent editor at the top, or by clicking the **...** button on an agent card in the dashboard and selecting **Rename**. ```text theme={null} Image Analysis and Description ``` ### Step 5: Save your changes Your changes are saved automatically as you edit. To trigger a manual save, press **⌘S** on macOS or **Ctrl+S** on Windows. If you're already using the agent's API, make sure to publish your changes so that the API reflects the updated agent. ### Step 6: Test it out! Once you have created your agent, you can test it out using automatically generated test cases. This will help you ensure that it behaves as expected and meets your requirements. To learn more about how to test your agent, check out the [Testing Agents](/guides/integration-and-testing/testing) section. # Deleting an Agent Source: https://docs.logic.inc/guides/agent-editing/deleting-agents How to delete an agent in Logic ## Deleting an Agent ![agent-list-hover-menu](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_list_hover_menu.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=93d7937fa83441138d6df4de6efbfe98) ### Step 1: Access the Logic dashboard Open the [Logic dashboard](https://app.logic.inc) and log in to your account. ### Step 2: Find the agent Locate the agent you want to delete in the list of agents on the dashboard. Click the **...** button on the agent card and select **Delete agent** from the menu. # Generating Agents from Description Source: https://docs.logic.inc/guides/agent-editing/generating-agents-from-description Create Logic agents quickly by describing what you need ## Creating Agents from a Description The description-based creation mode is the easiest way to create an agent in Logic. It allows you to quickly generate an agent by describing the task you want the Logic API to perform. > [!NOTE] > > Prefer manual creation? See [Creating and Editing > Agents](/guides/agent-editing/creating-and-editing-agents) for full > control over your agent structure. ![Logic dashboard](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_library.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=a8492c5bcfc14c0ab4bf184a67dcca89) ### Step 1: Describe what you need Type a description of what you want the agent to do into the text box at the top of the dashboard and press **Enter**. Logic will automatically generate an agent based on your description. For example, if you wanted to create an agent for image analysis, you might write something like: ```text theme={null} Take an image and tell me what's in it ``` From this description, Logic will create an agent with a structure similar to the following: ```text theme={null} Analyze Image Contents Introduction This agent provides a step-by-step guide for analyzing an image to describe its contents. The goal is to use image recognition techniques to identify objects, scenes, and activities within the image. Process Step 1: Image Preprocessing 1. Obtain the image in a suitable digital format. 2. Ensure the image is clear and of sufficient quality for analysis. Step 2: Object Detection 1. Apply object detection algorithms to identify objects within the image. 2. Note the types of objects detected (e.g., animals, vehicles, buildings). Step 3: Scene Understanding 1. Analyze the context and setting of the image. 2. Identify the scene type (e.g., outdoor, indoor, landscape, portrait). Step 4: Activity Recognition 1. If applicable, recognize any activities or actions depicted in the image. 2. Describe the activities in detail (e.g., walking, running, reading). Input - Digital image file. Output - Description of the image contents, including: - Identified objects - Scene type - Recognized activities ``` ### Step 2: Test it out! Once you have created your agent, you can test it out using automatically generated test cases. This will help you ensure that it behaves as expected and meets your requirements. To learn more about how to test your agent, check out the [Testing Agents](/guides/integration-and-testing/testing) section. # Using the Logic Dashboard Source: https://docs.logic.inc/guides/agent-editing/logic-dashboard How to use the Logic dashboard to manage your agents ## Using the Logic Dashboard The [Logic dashboard](https://app.logic.inc) is a web app for writing and managing your agents. It provides a user-friendly interface for creating, testing, and executing agents. In this section, we will cover the basics of how to use the dashboard. ![logic-dashboard](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_library.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=a8492c5bcfc14c0ab4bf184a67dcca89) ### Step 1: Accessing the Logic dashboard Open the [Logic dashboard](https://app.logic.inc) and log in to your account. You'll be given the choice to login with an email address or to continue with a Google account. After you sign in, you will be taken directly to the dashboard. ### Step 2: Viewing the dashboard When viewing the dashboard, you will see a list of your agents. Each agent will display its name and the date it was last updated. You can click on an agent to open it in the editor. You can create a new agent by describing what you need in the command bar at the top of the dashboard, or by clicking the **New Agent** button in the top right corner. To manage your accounts and API keys, click the **gear icon** in the bottom left corner of the dashboard to open **Organization Settings**. To manage your personal account settings, click your **profile picture** in the bottom left corner of the dashboard to open **Account Settings**. To sign out, open **Account Settings** and click the **Sign Out** button at the bottom of the page. ### Step 3: Creating a new agent > [!NOTE] > > To learn more about how to create a new agent, check out the [Making a New > Agent](/guides/agent-editing/making-agents) section. # Making a New Agent Source: https://docs.logic.inc/guides/agent-editing/making-agents Choose how to create your first agent in Logic ## Creating a New Agent Once you have access to the Logic dashboard, you can create a new agent by describing what you need or by creating it manually. Choose the method that best fits your needs. > [!NOTE] > > Want to learn more about how agents work in Logic? Check out the > [Understanding Agents](/guides/other/understanding-agents) section. ### Step 1: Access the Logic Dashboard Open the [Logic dashboard](https://app.logic.inc) and log in to your account. ### Step 2: Choose Your Creation Method ![Logic dashboard](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_library.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=a8492c5bcfc14c0ab4bf184a67dcca89) **Option 1: Generate from Description (Recommended)** Type a description of what you need into the text box at the top of the dashboard. Logic will automatically generate an agent for you. This is the fastest way to get started. → [Generate an agent from description](/guides/agent-editing/generating-agents-from-description) **Option 2: Create Manually** Click the **+ New Agent** button to open a blank agent editor. This gives you full control over the structure and content, and is useful if you have specific requirements or want a custom agent. → [Create and edit an agent manually](/guides/agent-editing/creating-and-editing-agents) > [!NOTE] > > You can edit either agent type after creation to better fit your needs. # Generating 3D Objects Source: https://docs.logic.inc/guides/example-agents/3dobj How to make an agent that generates 3D objects ## Making an Agent that Generates 3D Objects To create an agent that generates 3D objects, all you need to do to get started is state that you are generating a 3D object in the agent's body. The Logic API will automatically handle the rest. ![3d demo](https://mintcdn.com/logic/TWwgsfz3tF59SuRP/screenshots/demo_3d.png?fit=max\&auto=format\&n=TWwgsfz3tF59SuRP\&q=85\&s=a59a812fefb95c85dd4478284c157330) ### Step 1: Creating the agent As an example, let's make an agent that can generate simple 3D objects from text descriptions. To make this agent that generates 3D objects, we can use the following content: ```markdown theme={null} From a text prompt, generate a 3D model of the object described. Return the object as the text as a .obj file. ``` ### Step 2: Testing this iteration of the agent Using the `Preview` button, we can test this agent to see if it works as expected. The agent will generate a 3D object based on the text prompt provided. For the first iteration of the agent, we have a few issues. The agent was able to generate a 3D object, but it was not able to return the object as a .obj file. Instead, it returned the object as a text string encoded in base64. Once the base64 content is decoded and imported into a 3D viewer, I saw additional issues. The object was missing some faces, and had some other faces that were not visible, as they were facing the wrong direction. This is a common issue with 3D objects, and it can be fixed by flipping the normals of the object. ### Step 3: Improving the agent To improve the agent, we can add more specific instructions to the agent's body. For example, we can specify that we want the agent to return the object as the text contents of an .obj file, and that we want the agent to make sure all faces are visible and facing the right direction. To do this, we need to offer a few more details in the agent's body. I added a description of the .OBJ file format, and a few details about how the direction of the faces are handled in the .OBJ file format. ```markdown theme={null} ## From a text prompt, generate a 3D model of the object described. Return the object as a .obj file. Make sure that there are no faces of the object that are facing the incorrect direction. IE, for a cube, all faces should be facing outwards so you cannot see into the cube. This means the bottom face for the object needs to point outwards, not up into the center of the object. More info on how to do this below. ## An OBJ file is structured as the following: ### List of geometric vertices, with (x, y, z, [w]) coordinates, w is optional and defaults to 1.0. v 0.123 0.234 0.345 1.0 v ... ### Polygonal face element (see below). With multiple digit numbers, make sure there is a space between f 1 2 3 10 12 15 f ... ## Example Object: ### Here is a simple example of an OBJ file, for a cube, taken from the specification v 0.000000 2.000000 2.000000 v 0.000000 0.000000 2.000000 v 2.000000 0.000000 2.000000 v 2.000000 2.000000 2.000000 v 0.000000 2.000000 0.000000 v 0.000000 0.000000 0.000000 v 2.000000 0.000000 0.000000 v 2.000000 2.000000 0.000000 f 1 2 3 4 f 8 7 6 5 f 4 3 7 8 f 5 1 4 8 f 5 6 2 1 f 2 6 7 3 ### For this example, if a user asked for "a simple 3D cube", you would return "v 0.000000 2.000000 2.000000 v 0.000000 0.000000 2.000000 v 2.000000 0.000000 2.000000 v 2.000000 2.000000 2.000000 v 0.000000 2.000000 0.000000 v 0.000000 0.000000 0.000000 v 2.000000 0.000000 0.000000 v 2.000000 2.000000 0.000000 f 1 2 3 4 f 8 7 6 5 f 4 3 7 8 f 5 1 4 8 f 5 6 2 1 f 2 6 7 3" ## To Prevent Faces on Objects Facing the Incorrect Direction: Wavefront .obj files assume a counter-clockwise (CCW) winding order for defining the "front" face of a polygon. This determines the direction of the face normal, which affects how it is rendered, especially with lighting and backface culling. ### In the case of an object with the vertices of: v 0.000000 0.000000 0.000000 v 1.000000 0.000000 0.000000 v 1.000000 1.000000 0.000000 v 0.000000 1.000000 0.000000 v 0.500000 0.500000 1.000000 ### This entry in the .obj file would make this face point up, as it is clockwise when viewed from above: f 1 2 3 4 This is fine for making the top of an object, but... ### If making the bottom of an object, we would want this to be: f 4 3 2 1 As this would be CCW when viewed from below ``` ### Step 4: Testing this New Iteration of the Agent With all of these updates, the agent was able to generate a 3D object based on the text prompt provided. The agent returned the object as the text contents of a simple .obj file, and all faces were visible and facing the right direction. ### Conclusion In conclusion, creating an agent that creates a 3D object is easy with the Logic API. By simply stating that you want to generate a 3D object in the agent's body, the Logic API will automatically handle the rest. You can correct and improve the agent by adding more specific instructions to the agent's body. This will help the Logic API understand what you want the output to look like, and how to fix any issues you run into. Now, you can publish your agent and begin using the API to generate simple 3D objects. # Importing a Document (PDF, Word, Excel) Source: https://docs.logic.inc/guides/example-agents/pdf How to make an agent that reads from a PDF or Office document ## Making an Agent That Reads from a File To make an agent that reads from a PDF or Office document (like Word, Excel, or PowerPoint), all you need to do is state that you are reading from a file in the agent's body. The Logic API will automatically convert and handle the rest. ![demo pdf](https://mintcdn.com/logic/TWwgsfz3tF59SuRP/screenshots/demo_pdf.png?fit=max\&auto=format\&n=TWwgsfz3tF59SuRP\&q=85\&s=2012312e0dd92b92c49f28a2c27c0ffe) ### Step 1: Creating an agent that summarizes lease agreements As an example, let's create an agent that summarizes lease agreements. The agent will read from a PDF file and summarize the key points of the lease agreement. We want the agent to contain a summary of the costs, terms, and conditions of the lease agreement. The agent will also include a list of the parties involved in the lease agreement. To start, let's create an agent with the following content: ```markdown theme={null} From a PDF file of a lease agreement, create a summary. Make a summary of the charges and monthly fees. Make a list of any avoidable charges and inform the user of what they need to do to avoid having to pay any extra money. ``` ### Step 2: Testing this iteration of the agent Using the `Preview` button, we can test this agent to see if it works as expected. The agent will read from the PDF file and summarize the key points of the lease agreement. By testing this agent with an example lease agreement PDF, we can see the output: ```markdown Output theme={null} "output": { "avoidableCharges": [ { "description": "Late Payment", "amount": 75, "avoidanceInstructions": "Pay your rent on or before the 1st of each month to avoid the $75 late fee." }, { "description": "Dishonored Payment", "amount": 25, "avoidanceInstructions": "Ensure your payment method has sufficient funds and is correctly set up to prevent bounced checks or declined transactions." }, { "description": "Key Replacement Charge", "amount": 25, "avoidanceInstructions": "Keep track of all issued keys and return them at move-out to avoid a $25 replacement fee." }, { "description": "Smoke/CO Alarm Tampering Charge", "amount": 75, "avoidanceInstructions": "Do not tamper with or disable any smoke or CO alarms. Report any alarm issues to management for repair." }, { "description": "Flea Spraying Charge", "amount": 35, "avoidanceInstructions": "Maintain pet and unit cleanliness and use preventative flea treatments to avoid this $35 service fee." }, { "description": "Utilities (Late Setup)", "amount": 50, "avoidanceInstructions": "Set up all required utilities before the move-in date to avoid the $50 late-setup charge." }, { "description": "Lease Buy-Out", "amount": 5580, "avoidanceInstructions": "Fulfill the full lease term (June 1, 2024 to June 30, 2025) rather than terminating early to avoid the $5,580 buy-out fee." } ], "contactInfo": { "phoneNumbers": [ "(206) xxx-xxxx", "(916) xxx-xxxx", "(xxx) xxx-xxxx" ], "emailAddresses": null, "physicalAddresses": [ "512 Ocean Ave, Santa Cruz, CA 95060", "760 Iron Road, Fowler, CA 93625" ], "availableHours": [ "Tue-Fri 9:00am - 5:00pm", "Sat 10:00am - 4:00pm" ] }, "chargesAndMonthlyFees": [ { "description": "Vacancy Cost Recovery Fee", "amount": 50 }, { "description": "Utilities (Late Setup)", "amount": 50 }, { "description": "Flea Spraying Charge", "amount": 35 }, { "description": "Lease Buy-Out", "amount": 5580 }, { "description": "Key Replacement Charge", "amount": 25 }, { "description": "Late Payment", "amount": 75 }, { "description": "Dishonored Payment", "amount": 25 }, { "description": "Smoke/CO Alarm Tampering Charge", "amount": 75 }, { "description": "Base Rent", "amount": 2790 }, { "description": "Parking Rent", "amount": 45 } ] }, ``` The agent is working as expected, but it still needs some tweaks. The Logic API was able to read the PDF file and create a summary of the charges and monthly fees, but the summary doesn't include details like the resident's name, the address of the housing, or the name of the owner of the property. The API did correctly summarize the avoidable charges, with cost. ### Step 3: Improving the agent To improve the agent, we can add more specific instructions to the agent's body. For example, we can specify that we want the agent to include the cost of each item in the summary. ```markdown theme={null} From a PDF file of a lease agreement, create a summary. Start at the top with key details like the address of the housing, the name of the owner of the property, the name of the resident, and any other applicable details. Make a summary of the charges and monthly fees and how much each of them are. Additionally, offer a simple explanation of what each fee is and what it means to the user. Make a list of any avoidable charges and inform the user of what they need to do to avoid having to pay any extra money. At the end of the summary, make sure to share all contact info available, whether this be phone numbers, email addresses, addresses and times they're available, etc. ``` ### Step 4: Testing this new iteration of the agent Using the `Preview` button, we can test this agent to see if it works as expected. The agent will read from the PDF file and summarize the key points of the lease agreement. ```markdown new output theme={null} "output": { "keyDetails": { "housingAddress": "512 Ocean Ave, Santa Cruz, CA 95060", "ownerName": "512 Ocean Ave Partners LLC", "residentName": "First Name Last Name", "otherDetails": [ { "label": "Residential Community", "value": "The Brakes" }, { "label": "Unit Number", "value": "A212" }, { "label": "Lease Start Date", "value": "6/1/2024" }, { "label": "Lease End Date", "value": "6/30/2025" }, { "label": "Lease Term Length", "value": "1 year and 1 month" }, { "label": "Date Signed", "value": "May 15, 2024" } ] }, "avoidableCharges": [ { "description": "Late Payment Fee", "amount": 75, "avoidanceInstructions": "Pay rent by the 1st of each month to avoid the $75 late fee applied after the 4th." }, { "description": "Dishonored Payment Fee", "amount": 25, "avoidanceInstructions": "Ensure sufficient funds or use a reliable payment method to prevent bounced payments." }, { "description": "Smoke/CO Alarm Tampering Charge", "amount": 75, "avoidanceInstructions": "Do not tamper with smoke or carbon monoxide detectors to avoid this safety-related fee." }, { "description": "Key Replacement Charge", "amount": 25, "avoidanceInstructions": "Keep track of your keys and return all original keys at move-out to avoid replacement charges." }, { "description": "Utilities (Late Setup) Fee", "amount": 50, "avoidanceInstructions": "Contact utility providers and set up service before move-in to avoid late-setup fees." }, { "description": "Flea Spraying Charge", "amount": 35, "avoidanceInstructions": "Maintain cleanliness and pest control (treat pets as needed) to prevent flea infestations." }, { "description": "Lease Buy-Out Fee", "amount": 5580, "avoidanceInstructions": "Fulfill the full lease term or arrange a proper sublet per lease terms to avoid early termination fees." }, { "description": "Vacancy Cost Recovery Fee", "amount": 50, "avoidanceInstructions": "Complete the full lease term and give proper notice before moving out to avoid vacancy recovery fees." } ], "contactInfo": { "phoneNumbers": [ "(206) xxx-xxxx", "(916) xxx-xxxx" ], "emailAddresses": null, "physicalAddresses": [ "512 Ocean Ave, Santa Cruz, CA 95060", "760 Iron Road, Fowler, CA 93625" ], "availableHours": [ "Tue-Fri 9:00am - 5:00pm", "Sat 10:00am - 4:00pm" ] }, "chargesAndMonthlyFees": [ { "description": "Vacancy Cost Recovery Fee", "amount": 50, "explanation": "Fee charged to recover costs when the unit is left vacant outside your lease term." }, { "description": "Utilities (Late Setup)", "amount": 50, "explanation": "One-time fee for late utility account setup if utilities aren’t active by move-in." }, { "description": "Flea Spraying Charge", "amount": 35, "explanation": "Cost for professional flea extermination if pests are found in the unit." }, { "description": "Lease Buy-Out", "amount": 5580, "explanation": "Fee required to terminate the lease early (prorated base rent)." }, { "description": "Key Replacement Charge", "amount": 25, "explanation": "Fee to replace lost or unreturned apartment keys." }, { "description": "Late Payment Fee", "amount": 75, "explanation": "Penalty for rent not paid by the due date (the 1st of the month)." }, { "description": "Dishonored Payment Fee", "amount": 25, "explanation": "Charge for returned or bounced rent payments." }, { "description": "Smoke/CO Alarm Tampering Charge", "amount": 75, "explanation": "Penalty for tampering with or disabling smoke or carbon monoxide detectors." }, { "description": "Base Rent", "amount": 2790, "explanation": "Monthly rental payment for the apartment unit." }, { "description": "Parking Rent", "amount": 45, "explanation": "Monthly fee for the assigned parking space." }, { "description": "Application Fee", "amount": 124.04, "explanation": "One-time processing fee for reviewing your rental application (already paid)." } ] } ``` In this new iteration of the agent, the Logic API was able to read the PDF file and create a summary of the key points of the lease agreement. The agent included the cost of each item in the summary, as well as a simple explanation of what each fee is and what it means to the user. ### Conclusion In summary, the Logic API makes it simple to read from a PDF or Office file. By including an instruction in the agent body indicating that a file should be read, the Logic API will automatically manage the required processing, including any necessary conversions from formats like Word or Excel into PDF. You can correct and improve the agent by adding more specific instructions to the agent's body. This will help the Logic API understand what you want it to do with the file. Now, you can publish your agent and begin using the API to read from PDF files and other documents. # Song Recommender Source: https://docs.logic.inc/guides/example-agents/song-recommender How to make an agent that analyzes user input to make a recommendation ## Making an Agent that Provides Recommendations To make an agent that provides recommendations to the user, all you need to do is state the input you want to analyze and the type of recommendation you want to make in the agent's body. The Logic API will automatically handle the rest. ![song rec demo](https://mintcdn.com/logic/TWwgsfz3tF59SuRP/screenshots/demo_song_rec.png?fit=max\&auto=format\&n=TWwgsfz3tF59SuRP\&q=85\&s=367bb8a2f0f9a4b1ac8ceb92211a9647) ### Step 1: Creating the agent For this example, let's create an agent that recommends songs to the user based on their input. The agent will analyze the user's input and provide a recommendation. For the input on this agent, we will use the contents of a CSV file of songs from a playlist. It's easy to convert Spotify playlists to CSV files, and we can use this to create an app that reads from the Spotify API later. ### Step 2: Explain the goal Let's start by explaining what we want the Logic API to do. We want the agent to analyze the user's input and provide a recommendation based on the input. The agent will read from a CSV file of songs from a playlist, analyze the user's taste, and provide 5 recommendation songs. We want the agent to take note of the following: * The songs in the playlist * The artists of the songs * The albums of the songs * The release dates of the songs * The genres of the songs ### Step 3: Explain the input To give the Logic API some extra context, let's make sure to explain the input we want to analyze. We will be providing a CSV file of songs from a playlist. The CSV file will contain the following data: ```markdown CSV file contents theme={null} "Track URI","Track Name","Artist URI(s)","Artist Name(s)","Album URI","Album Name","Album Artist URI(s)","Album Artist Name(s)","Album Release Date","Album Image URL","Disc Number","Track Number","Track Duration (ms)","Track Preview URL","Explicit","Popularity","ISRC","Added By","Added At" ``` ### Step 4: Give an example We also want to provide an example of the CSV file contents and an example recommendation. ```markdown Examples theme={null} Example CSV file input: "spotify:track:0s1PsjRpN9v3gveUOM6Iux","Neon Roses","spotify:artist:6hQS54VPpxunuwR0W7usuo","The Technicolors","spotify:album:0oWKnbYnV4rzCcZoo6DWP2","Metaphysical","spotify:artist:6hQS54VPpxunuwR0W7usuo","The Technicolors","2017-07-27","https://i.scdn.co/image/ab67616d0000b273384ba1e1ee57378cf6272ae4","1","1","236586","https://p.scdn.co/mp3-preview/434f407ec4075665fe641fa9fb18d91031c477e9?cid=9950ac751e34487dbbe027c4fd7f8e99","false","56","TCADB1731048","spotify:user:romangarms","2024-02-04T07:22:04Z" "spotify:track:20I8RduZC2PWMWTDCZuuAN","Take Me Out","spotify:artist:0XNa1vTidXlvJ2gHSsRi4A","Franz Ferdinand","spotify:album:0vi5ePiEHrGZJF7QhnDW2z","Franz Ferdinand","spotify:artist:0XNa1vTidXlvJ2gHSsRi4A","Franz Ferdinand","2004-02-16","https://i.scdn.co/image/ab67616d0000b27309a90531b85be7899c3234c4","1","3","237026","https://p.scdn.co/mp3-preview/f91cfdf3dd5f7114cf47f8c8b2567b7a8a76d9ed?cid=9950ac751e34487dbbe027c4fd7f8e99","false","85","GBCEL0300192","spotify:user:romangarms","2024-02-04T07:21:51Z" "spotify:track:6DjVpyhiisbxSJrUkyoEJx","Restless","spotify:artist:0Z5pcmXDCKTrFWLnDChC37","Miami Horror","spotify:album:0SBHMIlE92TmGMG2uE4puk","Restless","spotify:artist:0Z5pcmXDCKTrFWLnDChC37","Miami Horror","2019-06-28","https://i.scdn.co/image/ab67616d0000b273d7b048b49c00a7c211acb69d","1","1","205948","https://p.scdn.co/mp3-preview/a69d2fac977959055196a6fb9e0b1e7a25d8aa8a?cid=9950ac751e34487dbbe027c4fd7f8e99","false","0","QZGLM1904240","spotify:user:romangarms","2024-02-04T07:23:22Z" Example Output These songs are all relatively modern (2004 or newer), all have reasonably complex lyrics. They skew a bit indie, with Franz Ferdinand likely being the most popular. You might recommend songs by the artist Local Natives, as the songs can be similar genre-wise to The Technicolors. You might recommend other early 2000s one-hit wonders like Franz Ferdinand sometimes is seen as. You might recommend other Miami Horror songs, like those off a more recent album ``` We want to make sure to set some ground rules for the recommendation. For example, we want to make sure that the recommendation is based on the user's input and that it is relevant to the user's input. We also want to make sure we don't recommend songs that are already in the user's playlist. ### Step 5: Testing this iteration of the agent Using the `Preview` button, we can test this agent to see if it works as expected. ```markdown Logic API Output theme={null} { "tasteAnalysis": "Your music taste centers around modern indie pop/rock and synthpop with strong electronic influences. You favor artists from the 2010s and 2020s but appreciate some earlier classics. There's a balance between upbeat, danceable tracks and more introspective or dreamy songs. You enjoy both catchy hooks and thoughtful lyrics, with a preference for atmospheric production and exploring full albums or discographies from your favorite artists.", "recommendations": [ { "trackName": "Oblivion", "artistNames": [ "Grimes" ], "albumName": "Visions", "albumReleaseDate": "2012-01-31", "explanation": "Grimes' blend of synthpop and indie electronic fits perfectly with your love for artists like CHVRCHES and Miami Horror. 'Oblivion' is a modern classic with catchy hooks and atmospheric production." }, { "trackName": "Sweet Disposition", "artistNames": [ "The Temper Trap" ], "albumName": "Conditions", "albumReleaseDate": "2009-06-19", "explanation": "This indie anthem combines soaring vocals with lush instrumentation—ideal for fans of Phoenix, Two Door Cinema Club, and The Technicolors." }, { "trackName": "Seventeen", "artistNames": [ "Sharon Van Etten" ], "albumName": "Remind Me Tomorrow", "albumReleaseDate": "2019-01-18", "explanation": "Sharon Van Etten's modern indie rock sound and emotive delivery will appeal to your appreciation for thoughtful lyrics and atmospheric production." }, { "trackName": "Peach", "artistNames": [ "Broods" ], "albumName": "Don't Feed the Pop Monster", "albumReleaseDate": "2019-02-01", "explanation": "Broods offer a polished blend of indie pop and synth-driven hooks that align well with your playlist's vibe—think CHVRCHES meets BØRNS." }, { "trackName": "Youth", "artistNames": [ "Glass Animals" ], "albumName": "How To Be A Human Being", "albumReleaseDate": "2016-08-26", "explanation": "Glass Animals' 'Youth' brings together dreamy indie pop with electronic textures—perfect for fans of Still Woozy and The Neighbourhood." } ] } ``` When testing this agent, the Logic API gave a recommendation based on the user's input. The agent was able to analyze the user's input and provide a recommendation based on the input. The agent also provided a list of songs that were similar to the user's input. One of the songs that was recommended was by an artist that was already in the user's playlist. However, it was a new song, and was off of a different album. Three of the other recommendations were by artists that were not in the user's playlist, but were songs that the user already had in other playlists. This suggests these were accurate recommendations, as the user does already like these songs. One last recommendation was a song that was not in the user's library at all. The song was by a new artist, and was a similar genre to the user's input. This is a good recommendation, as the Logic API was able to find completely new music for the user. ### Conclusion In summary, generating an agent that provides recommendations is straightforward with the Logic API. By specifying the input to be analyzed and the desired type of recommendation within the agent body, the Logic API will automatically perform the necessary processing. Now, you can publish your agent and begin using the API to provide recommendations to your users. You could make an app or website that reads from the Spotify API to get the user's playlists, and also uses the API to create a new playlist with the recommendations. # Using Logic as an MCP Server Source: https://docs.logic.inc/guides/integration-and-testing/MCP-servers How to configure and use Logic agents as MCP Servers ## What is an MCP Server? An MCP (Model Context Protocol) Server allows you to connect other platforms to Logic's agents. Since Logic hosts the server, other applications can send requests to Logic's agents and receive responses, enabling seamless integration across different services. With this, you can write your AI rules once in Logic, and any MCP-compatible tools can use them. ### For Example Imagine you've created a Logic agent that validates code against your company's style guide. With the Logic MCP Server enabled, you could use Claude Code to automatically call this Logic agent whenever you're writing code. Instead of manually checking your code against the style guide, Claude Code would send your code to the Logic agent and receive feedback on style violations, best practices, and suggested improvements—all based on the rules you've defined once in Logic. ## Getting Started > [!NOTE] > > For step-by-step setup instructions and platform-specific guides, see the [MCP > Documentation](/mcp/introduction). # Using the API Source: https://docs.logic.inc/guides/integration-and-testing/api Using the API for your agent ## Using the API ![api keys](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/api_keys.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=09b093a90b61c770ace8b3d487797b45) ### How to Use the API When you publish an agent, Logic automatically generates an API for your agent. This API allows you to interact with your agent programmatically, making it easy to integrate it into your applications or workflows. To learn more about the available API endpoints, check the [API Documentation](/api-reference). This documentation provides detailed information on how to use the API, including examples of requests and responses. The **Entrypoints** section also provides the endpoint and a link to the REST API docs, with example calls in several different languages. To get started immediately, set up your API key and try executing your agent. > [!NOTE] > > Learn how to get started with the API in the [API > Reference](/api-reference/quick-start) section. # Email Execution Source: https://docs.logic.inc/guides/integration-and-testing/email-execution Triggering agent executions by sending an email ## What is Email Execution? Email execution allows you to trigger an agent execution by sending an email to a unique email address. The email subject, body, and any attachments will be used as input for the execution. This is useful when you want to integrate an agent into an email-based workflow without writing any code or calling the API directly. ## Enabling Email Execution To enable email execution for an agent, follow these steps: 1. Open the agent in the editor. 2. Navigate to the **Entrypoints** section. 3. Find the **Email** card. 4. Toggle the switch on the **Email** card to enable it. Once enabled, a unique execution email address will be generated for your agent. ![email execution disabled](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/email_execution_disabled.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=bf2b04ae15ccd7ad36040847a0e7fa24) > [!WARNING] > > The execution email address acts as a secret credential. Anyone with the > address can trigger executions on your agent. Treat it like an API key and do > not share it publicly. ## Your Execution Email Address After enabling email execution, you can view and copy your agent's execution email address from the **Email** card in the **Entrypoints** section. ![email execution enabled](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/email_execution_enabled.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=00e656fd57690830684f38bf2e848141) The email address is hidden by default. Click the eye icon to reveal it, then use the **Copy** button to copy it to your clipboard. ## Sending an Email To trigger an execution, send an email to your agent's execution email address. The following parts of the email are passed as input to the agent: * **Subject** — the email subject line * **Body** — the plain text body of the email * **Attachments** — any files attached to the email ### Targeting a Specific Version By default, the live (published) version of the agent will be executed. To execute a different version, add one of the following tags to the email subject line: * `[draft]` — Execute the current draft version * `[]` — Execute a specific version by its UUID For example, an email with the subject `Process this report [draft]` would execute the current draft version of the agent. ### Attachments Email execution supports file attachments. Attachments are uploaded and passed to the agent as part of the execution input. > [!NOTE] > > The total size of all attachments must not exceed 25 MB. The email body > (excluding attachments) must not exceed 100 KB. ## Viewing Execution Results Executions triggered via email appear in the agent's execution history alongside API-triggered executions. You can view the input, output, and status of each execution in the agent's **Execution history**. If an email fails validation (for example, if the agent has no published version), a failed execution record will still appear in the history so you can diagnose the issue. ## Regenerating the Email Address If you need to replace your agent's execution email address, click the **Regenerate** button on the **Email** card in the **Entrypoints** section. > [!WARNING] > > The old email address will stop working immediately. Any integrations using > the old address will need to be updated with the new one. ## Disabling Email Execution To disable email execution, toggle the switch on the **Email** card off. This will revoke the current email address and prevent any further email-triggered executions. > [!WARNING] > > The current email address will stop working immediately. Any integrations > using this address will no longer be able to trigger executions. ## Requirements The agent must have a published version for email execution to work, unless you are targeting the draft version by adding `[draft]` in the subject. > [!NOTE] > > Learn more about publishing and versioning in the [Spec > History](/guides/versions-and-history/spec-history) section. # Integrating Your Agent Source: https://docs.logic.inc/guides/integration-and-testing/integration Getting started with the API for your agent ## Automatic API Generation When you publish an agent, Logic automatically generates an API for your agent. This API allows you to interact with your agent programmatically, making it easy to integrate it into your applications or workflows. Information on the API and how to use it can be found in the **Entrypoints** section of the agent editor. ![agent-integration](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_integration.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=7ac98d7c6ed48851bbc26a971d5db26b) ### Endpoint In the **Entrypoints** section, the **REST API** card shows the API endpoint for your agent. This is the URL that you will use to call your agent's API. ### 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. > [!NOTE] > > Learn more about authorization and how to set up your API token in the [Authorization section](/api-reference/authorization). ## Before You Use the API Make sure you understand the input and output schema for your agent. This will help you structure your requests and understand the responses you will receive. > [!NOTE] > > Learn more about the input and output schema in the [Agent > Schemas](/guides/integration-and-testing/schemas) section. ## Email Execution You can also trigger agent executions by sending an email, without writing any code or calling the API directly. > [!NOTE] > > Learn how to set up email execution in the [Email > Execution](/guides/integration-and-testing/email-execution) section. ## Sending Emails Agents can send emails to members of your organization as part of an execution. This is useful for workflows that need to notify team members or share results. > [!NOTE] > > Learn more about sending emails in the [Sending > Emails](/guides/integration-and-testing/send-email) section. ## Ready to Use the API? Now that you want to get started with the API, check out the API documentation to learn how to get started. > [!NOTE] > > Learn how to use the API in the [API Reference](/api-reference) section. # Agent Schemas Source: https://docs.logic.inc/guides/integration-and-testing/schemas Understanding the input and output schema of an agent ## Input and Output Schema The **Inputs** and **Outputs** of the **Data Contract** section provide information on the input and output data for your agent's API. This includes the data types and descriptions of each field. You can use this information to understand how to structure your requests and responses when calling your agent's API. Input and output schemas will be a JSON object. The exact structure depends on your agent, but an example can be found below: ![agent-schemas](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_input_schema.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=51912dc92e8c32a4f78e01e3532f0101) ### Input Schema Example ```json theme={null} { "content": { "type": "string", "description": "The text content from which PII should be redacted." } } ``` This schema indicates that the input to the agent's API should be a JSON object with a single field, `content`, which is a string containing the text to be processed. You can find the API endpoint and a link to the REST API docs in the **Entrypoints** section as well. ### Output Schema Example ```json theme={null} { "redactedText": { "type": "string", "description": "The text with all detected PII replaced by appropriate placeholders (e.g., {{ name }}, {{ email }})." }, "redactedEntities": { "type": "array", "description": "A list of entities that were redacted from the original content.", "items": { "type": "string", "description": "A single entity that was redacted from the content." } } } ``` This schema indicates that the output from the agent's API will be a JSON object with two fields: `redactedText`, which is a string containing the text with PII redacted, and `redactedEntities`, which is an array of strings listing the entities that were redacted. You can find the API endpoint and a link to the REST API docs in the **Entrypoints** section as well. > [!NOTE] > > The input and output schemas will differ depending on your agent. ## Get started with the API Now that you understand the input and output schema, you can start using the API for your agent. > [!NOTE] > > Learn how to get started with the API in the [Using the > API](/guides/integration-and-testing/api) section. # Sending Emails Source: https://docs.logic.inc/guides/integration-and-testing/send-email Send emails to organization members from within an agent execution ## What is Sending Emails? Agents can send emails to members of your organization during execution, making it easy to notify team members or share results. > [!NOTE] > > Recipients must have an account in your Logic organization. Sending to external email addresses is not supported. ## How It Works When email sending is enabled for an agent, the Logic API can send emails as part of an execution. The agent's instructions determine when and how emails are sent based on the task being performed. For example, an agent that generates a weekly sales report could automatically email the report to a team member when the execution completes. ## Enabling Email Sending To enable email sending in an agent, include instructions in your agent that describe when and to whom emails should be sent. Logic will automatically detect that email sending is needed and make it available during execution. ## Email Format Each email includes: * **To** — the recipient's email address (must be an organization member) * **Subject** — the email subject line * **Body** — the email content, sent as both plain text and HTML ## Limitations * **Organization members only** — emails can only be sent to users who are members of your organization. Attempts to send to external email addresses will be rejected. * **Rate limiting** — there is an hourly rate limit on the number of emails that can be sent per organization. * **No attachments** — only text and HTML content is supported. File attachments are not supported. > [!WARNING] > > Do not confuse sending emails with [Email Execution](/guides/integration-and-testing/email-execution). Email execution triggers an agent execution by sending an email *to* an agent. Sending emails allows an agent to send emails *from* within an execution. # Testing Your Agent Source: https://docs.logic.inc/guides/integration-and-testing/testing Validating your agent before publishing ## Automated Testing After writing an agent, several examples are automatically generated to validate your agent. These examples act as tests: each one describes how the agent should behave, and running them checks the agent against that expected behavior. You can see these examples and their results in the **Examples** section of the agent editor. ![agent-testing](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_testing.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=021c2542ee7fc1f926b866943f8e690e) ### Running Tests To run the tests, click the **Run All** button. This will execute all of the tests and display the results in the section below. ### Testing Statistics You can see statistics on your tests at the top of the page. This includes the total number of tests, as well as the number of tests that passed, failed, and resulted in uncertain answers. ### Test Cases and Results You can see a list of the tests used on your agent in the section below. You can review these tests to see the input and output for each test, as well as an auto-generated summary of why the test was marked as `passing`, `failing`, or `uncertain`. Tests can fail for a variety of reasons, so it's important to review the test results to understand why a test failed. ### What to Do If Tests Fail Tests can fail for a variety of reasons. They can fail because the agent is incorrect, or because the test itself is incorrect. Since all tests are initially auto-generated, it's possible that some tests may not be relevant or accurate. If you encounter failing tests, here are some steps you can take: 1. **Review the Test Results**: Look at the input and output for each test to understand why it failed. Is the result actually incorrect, or is the test checking for something that doesn't apply to your agent? 2. **Fix Agent Issues**: If the agent is incorrect, make the necessary changes to fix the issues. 3. **Edit or Remove Tests**: If a test is not relevant or accurate, you can edit it or remove it entirely. This may involve modifying the test's input or changing the expected output, or deleting the test if it's not needed. 4. **Rerun Tests**: After making changes, rerun the tests to see if the issues have been resolved. Continue this process until all tests pass. ## Happy with the Results? Tests pass? Great! You can now publish your agent. > [!NOTE] > > Learn how to use your agent in the [Integrating Your > Agent](/guides/integration-and-testing/integration) section. # Introduction to Logic Source: https://docs.logic.inc/guides/introduction Welcome to Logic's Documentation ![Hero Light](https://mintcdn.com/logic/YO7O6hkpncKkRwwK/images/hero-light.png?fit=max\&auto=format\&n=YO7O6hkpncKkRwwK\&q=85\&s=b3d99a02b374f38b988313e05a390b4d) ## Welcome Welcome to documentation for Logic! Here you can find everything you need to get started with Logic, including guides, example agents, and more. To find API documentation, visit the [API Reference](/api-reference) section. ### Getting Started To get started with Logic, begin by making your first agent. > [!NOTE] > > Learn how to make your first agent in the [Quick > Start](/guides/quick-start) section. # Accounts Source: https://docs.logic.inc/guides/organization-settings/accounts Manage your Logic team members and settings ![accounts list](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/accounts_list.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=f89c38f9f83a75259c88551bf33811b3) ## Accounts The **Accounts** page allows you to manage your team members in your Logic organization. You can invite new members, change their roles, and remove existing members within this page. ### Inviting Members Using the **Add Member** button in the top right of the section, you can invite new members to your organization. Inviting new members will send them an email invitation to join your team. ### Changing a Member's Role To change a member's role, click the **...** menu next to the member and select **Change role**. ### Removing Members To remove a member, click the **...** menu next to the member and select **Remove member**. # API Keys Source: https://docs.logic.inc/guides/organization-settings/api-keys Create and manage your API keys ![api keys](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/api_keys.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=09b093a90b61c770ace8b3d487797b45) ## API Keys The **API Keys** page allows you to create and manage your API keys for accessing the Logic API. You can generate new keys, as well as revoke and rename existing keys within this page. You can see when a key was created and when it was last used, which is helpful for determining unused keys. You can also see a truncated preview of the key, but for security reasons, you will not be able to see the full key again after you close the dialog when creating a new key. ### Creating a new API key Using the **Create Key** button in the top right of the section, you can create a new API key. This will open a dialog where you can enter a name for the key and generate it. Make sure to copy the key and store it in a secure location, as you will not be able to see it again after you close the dialog. ### Renaming an API key To rename an API key, click the **...** menu next to the key and select **Rename**. This will open a dialog where you can change the name of the key. This is useful for keeping track of what each key is used for. ### Deleting an API key To delete an API key, click the **...** menu next to the key and select **Delete**. This will open a dialog where you can confirm the deletion. Deleting a key will revoke its access to the Logic API, so make sure you no longer need the key before deleting it. # Billing Source: https://docs.logic.inc/guides/organization-settings/billing Manage your billing information ![billing settings](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/billing_settings.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=d0b4d4ca5cf56052e5bf9539d64c1156) ## Billing The **Billing** page allows you to manage your billing information for your Logic organization. Billing is handled through Stripe, a secure payment processor. # Knowledge Library Source: https://docs.logic.inc/guides/organization-settings/knowledge-library Upload and manage files your agents can search during execution ![knowledge library](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/knowledge_library.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=c79a0d02f2019070fa627a798e77bdc3) ## What is the Knowledge Library? The Knowledge Library is an organization-wide file store that your agents can search and reference during execution. Upload files once, and any agent in your organization can draw on them as a knowledge source. > [!NOTE] > > The Knowledge Library is not available for all organizations. If you don't see > it in your settings, contact support to learn more. ## Accessing the Knowledge Library Click the **Knowledge Library** icon in the left sidebar to manage your organization's files. ## Uploading Files Click the **Upload here** button in the top right to upload a file. You can also drag and drop a file directly into the library. * **Maximum file size:** 10MB per file * **Supported types:** All common file types are accepted Files begin processing immediately after upload. A file must reach **Available** status before agents can search it. ## File Statuses | Status | Meaning | | - | - | | **Processing** | The file is being indexed. It is not yet searchable. | | **Available** | The file is fully processed and available for agents to search. | | **Error** | Processing failed. Click the file to see the error detail. | The page refreshes automatically while files are processing. ## Organizing with Folders Use the **New folder** button to create folders and keep your library organized. The folder browser on the left lets you navigate between folders. ## Downloading and Deleting Files Click any file in the library to open its detail modal. From there you can download the file or delete it. > [!WARNING] > > Deletion is permanent and cannot be undone. ## Using the Knowledge Library in an Agent To give an agent access to your library, open the agent in the editor and go to the **Knowledge** section. Under **Knowledge Library Search**, choose one of three modes: * **Default** — Logic decides whether to search the knowledge library based on the task. * **Entire Store** — Logic always searches the full library during execution. * **Specific Files** — You choose exactly which files the agent can search. Changes take effect the next time the agent is executed. # Organization Source: https://docs.logic.inc/guides/organization-settings/organization Manage your organization settings and compliance features ![organization settings](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/organization_settings.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=ca31b0ec2056d688f27c55affc2de8bf) ## Organization The **Organization** page allows administrators to manage core organization settings, including the organization name, HIPAA compliance mode, and email domain allowlist. > [!NOTE] > > This page is only accessible to organization administrators. ### Organization Details You can update your organization's name, which will appear across the Logic platform. The organization name has a maximum length of 100 characters. To update the organization name: 1. Enter the new name in the **Name** field 2. Click **Save Changes** to apply the update ### HIPAA Compliance > [!NOTE] > > HIPAA compliance mode is only available on the [Enterprise > tier](/guides/pricing-tiers). HIPAA compliance mode restricts logging and data retention to meet healthcare privacy requirements. When enabled, this setting ensures your organization meets HIPAA standards for handling sensitive health information. The status badge shows whether HIPAA compliance is currently **Enabled** or **Disabled** for your organization. To enable or modify HIPAA compliance settings, click **Contact Support**. The Logic support team will work with you to configure these settings appropriately for your organization's needs. ### Email Domain Allowlist The email domain allowlist allows anyone with a specific email domain (e.g., @yourcompany.com) to automatically join your organization when they sign up. The status badge displays either your configured domain (e.g., **@yourcompany.com**) or **Not configured** if no domain allowlist is set up. To configure or modify the email domain allowlist, click **Contact Support**. The Logic support team will help you set up domain-based automatic enrollment for your organization. # The Logic Bits Publication Source: https://docs.logic.inc/guides/other/logic-bits Logic Bits is the official publication for Logic, where you can find essays, experiments, and ideas on AI, product design, and more. ## Logic Bits We occasionally publish our thoughts, experiments, and lessons learned while building Logic. You can find them on [Logic Bits](https://bits.logic.inc), our public Substack. The topics vary, but include guides on how to use AI as a tool successfully, experiments with AI models, and insights into Logic development. ### Bits Posts You can find posts on a variety of topics, including the following: * **Your agent works. Now what?**: What comes after building an agent — deployment, iteration, and making it reliable in production. [Read it here](https://bits.logic.inc/p/your-agent-works-now-what). * **AI Is Forcing Us To Write Good Code**: How AI development tools are reinforcing best practices like testing and documentation. [Read it here](https://bits.logic.inc/p/ai-is-forcing-us-to-write-good-code). * **Codex is a Slytherin, Claude is a Hufflepuff**: A comparative look at how different AI coding agents behave in practice. [Read it here](https://bits.logic.inc/p/codex-is-a-slytherin-claude-is-a). * **Fine-Tuning Is (Probably) A Trap**: Why fine-tuning LLMs often isn't the right answer, and what to do instead. [Read it here](https://bits.logic.inc/p/fine-tuning-is-probably-a-trap). * **How to Ship Confidently When Your Backend Makes Things Up**: Strategies for handling LLM hallucinations and unreliable outputs in production. [Read it here](https://bits.logic.inc/p/how-to-ship-confidently-when-your). * **Getting gpt-4o-mini to perform like gpt-4o**: Using few-shot learning to bring smaller model performance closer to larger models. [Read it here](https://bits.logic.inc/p/getting-gpt-4o-mini-to-perform-like). * **Making a List and Checking It Twice**: How structured output works with LLMs, and the limitations it has. [Read it here](https://bits.logic.inc/p/making-a-list-and-checking-it-twice). # What Makes a Good Agent? Source: https://docs.logic.inc/guides/other/making-a-good-agent How to write good agents in Logic ## What Makes a Good Agent? A good agent in Logic is one that is clear, concise, and easy to understand. It should provide enough context for the Logic API to perform the task you want it to do, while also being flexible enough to handle variations in input. The most important idea is that LLM understanding is similar to human understanding. If you write an agent that is easy for a person to read and understand, it will also be easy for the Logic API to understand. Here are some tips for writing a good agent: ### 1. Be Clear and Concise Use simple language and avoid jargon. The agent should be easy to read and understand, even for someone who is not familiar with the topic. The Logic API is designed to handle a wide range of tasks, so you don't need to include every detail. Focus on the key points that are necessary for the Logic API to perform the task. ### 2. Provide Context Include enough information for the Logic API to understand the task you want it to perform. This might include examples of input and output, as well as any specific requirements or constraints. If you're using specific file formats, make sure to specify them clearly. For example, if you want the Logic API to analyze an image, specify whether the image will be provided as a URL or base64-encoded data. If you're using your own file formats, make sure to provide clear examples of how the data should be structured. This will help the Logic API understand how to process the input. ### 3. Use Text Formatting Using the agent editor, you can use text formatting to make your agent more readable. For example, you can use bullet points to list the items you want the Logic API to include in its analysis. You can also use headings to separate different sections of your agent. Make sure to organize your agent in a way that makes sense for the task at hand. For example, you might have a section for the input and a section for the output. ### 4. Test Your Agent To ensure your agent works as intended, test it out using the Logic API. You can do this by sending a request to the API with sample input and checking the output. This will help you identify any issues or areas for improvement. Be sure to use the testing tools in the Logic dashboard. Once you create an agent, a dedicated testing page is automatically generated, letting you verify its behavior and make edits as needed. ### 5. Iterate and Improve A good agent is never truly finished. As you use the Logic API and receive feedback, you may find areas where your agent can be improved. Don't hesitate to make changes and iterate on your agent to make it better. Use the testing features in the Logic dashboard to validate your agent. This will help you ensure that it behaves as expected and meets your requirements. # Server Status Source: https://docs.logic.inc/guides/other/server-status Checking the status of Logic's servers ## Server Status Logic provides multiple ways to check the status of its servers. You can check the status of the Logic API server via the API healthcheck endpoint, or you can check the status of the Logic platform via the [Logic Status Page](https://status.logic.inc/). ### Status Website ![Logic Status Page](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/status_page.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=f54d73db4fd08209b9656036cea2c5ee) For more detailed information about the status of the server, you can check the [Logic Status Page](https://status.logic.inc). This page provides real-time information about the status of the Logic API and any ongoing incidents or maintenance. The Logic Status Page will show you the current status of Logic's services, including the API and the dashboard. It will also provide information about any ongoing incidents or maintenance that may affect the performance of the Logic platform. ### API Server Status The API server status endpoint is used to check the status of the Logic API server. It returns a 200 OK response if the server is reachable and functioning properly. You can learn more about the API healthcheck endpoint in the [API Reference](/api-reference/other/healthcheck) section. # Understanding Agents Source: https://docs.logic.inc/guides/other/understanding-agents How to get started with agents in Logic ## Understanding Agents Logic agents are the core of the Logic platform. They are used to describe the tasks you want the Logic API to perform. Each agent consists of a description, a title, and a set of instructions that guide the Logic API in completing the task. Logic agents are detailed instructions that the Logic API follows to perform a specific task. They can be used for a wide range of purposes, such as analyzing images, processing text, or performing complex calculations. ### Agent Language Using Logic's agent editor, you can describe the task you want the Logic API to perform using natural language. Describe the inputs you'll be giving the Logic API, such as text, images, or files like PDFs, Word, Excel, and PowerPoint documents. Be specific about the result you want the Logic API to produce. For example, if you want the Logic API to analyze an image, you might say: ```text theme={null} Accept an image as a URL or base64-encoded data and tell me what it is. Include items like: - How many people are in it? - What is the dominant color of the image? - What's the general mood it invokes? ``` Be clear about what you want the Logic API to do. The more specific you are, the better the Logic API will perform. For example, if you want the Logic API to analyze an image, specify whether the image will be provided as a URL or base64-encoded data. ### Learning how to make better agents To create effective agents, it's important to understand the structure and components of an agent. You can learn more about what makes a good agent in the [What Makes a Good Agent?](/guides/other/making-a-good-agent) section. This section provides tips on how to write clear and concise agents that are easy to understand and result in better performance from the Logic API. To make your first agent, follow the steps in the [Making an Agent](/guides/agent-editing/making-agents) section. # Pricing Tiers Source: https://docs.logic.inc/guides/pricing-tiers Compare Logic pricing tiers and their features Logic offers several pricing tiers to meet the needs of individuals, teams, and enterprises. For current pricing, visit [logic.inc/pricing](https://logic.inc/pricing). ## Team Plans > **Trial** > > Get started with Logic at no cost: - Limited executions - 30-day log > retention - No credit card required > **Plus** > > Everything in Trial, plus: - Expanded web execution limits - Role-based > access with fine-grained permissioning - SOC2 compliance - 90-day log > retention > **Ultra** > > Everything in Plus, plus: - Unlimited monthly web executions (subject to > abuse guardrails) - Data excluded from training > **[Enterprise](https://logic.inc/pricing?enterprise=true)** > > Custom pricing for organizations at scale. Includes everything in Ultra, plus: > > * Tailored task limits based on volume - SCIM provisioning - Single Sign-On > (SSO) - HIPAA compliance for healthcare workflows - Dedicated Slack channel > for priority support - Hands-on onboarding and training - Priority feature > requests > **[API Pricing](/api-reference/introduction)** > > The API uses a pay-as-you-go model, billed per execution: - Agent executions - > Media executions (images, audio, video) - Tools executions # Quick Start Source: https://docs.logic.inc/guides/quick-start How to get started with agents in Logic ## Quick Start Logic agents are a powerful way to create and execute complex workflows. In this section, we will cover the 4 basic steps of how to get started with agents in Logic. ![logic-dashboard](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_library.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=a8492c5bcfc14c0ab4bf184a67dcca89) ### Step 1: Access the Logic dashboard and create a new agent Open the [Logic dashboard](https://app.logic.inc) and log in to your account. When you first log in, Logic will begin generating a few example agents for you to explore. You can use these agents as a starting point, or you can create your own agent from scratch. The fastest way to create an agent is to describe what you need in the command bar at the top of the dashboard and press **Enter**. Logic will automatically generate an agent for you, which you can then refine. Alternatively, you can click the **New Agent** button in the top right corner of the Logic dashboard to open a blank agent editor and build your agent manually. ### Step 2: Write a description and set a title What do you need the Logic API to do? Write a description of the task you want to accomplish. Additionally, set a title for your agent. This title will be used to identify your agent in the Logic dashboard. > [!NOTE] > > Learn how to write an agent in the [Making a New > Agent](/guides/agent-editing/making-agents) section. ### Step 3: Test it out! Once you have written up your agent, a preview page is automatically generated to the right of the agent editor. Use this to verify the functionality of your agent, and edit your agent as you see fit. ![logic-preview](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_preview.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=174848197b6127904a47100bd2c51971) > [!NOTE] > > Learn how to test your agent in the [Testing Your > Agent](/guides/integration-and-testing/testing) section. ### Step 4: Using the API endpoint Once your agent is published, you can use the API endpoint to execute your agent. You can publish your agent by clicking the **Publish** button in the top right corner of the agent editor. This will make the API endpoint for your agent available for use. > [!NOTE] > > Learn how to use the API in the [API Reference](/api-reference) section. # HTTP Tools Source: https://docs.logic.inc/guides/tools/http-tools Enable your agents to make external HTTP requests ## Overview Logic provides built-in HTTP tools that allow your agents to make external HTTP requests during execution. Your agents can fetch data from APIs, post to webhooks, and interact with any external service — all described in plain text within your agent. HTTP tools support all standard HTTP methods: **GET**, **POST**, **PUT**, **PATCH**, **DELETE**, and **OPTIONS**. ## How It Works HTTP tools are designed to be used naturally within your agent's instructions. You don't need to write code or specify technical tool names — just describe the HTTP request you want to make in plain language, and Logic's agent will detect the appropriate method and construct the request. For example, you might write in your agent: ``` Fetch the current weather data from https://api.weather.example.com/v1/current with the city as a query parameter. ``` Or for sending data: ``` Send a POST request to https://hooks.example.com/notify with a JSON body containing the analysis results. ``` The agent interprets these instructions, determines the correct HTTP method, and makes the request during execution. ## Describing Requests in Your Agent When writing HTTP instructions in your agent, you can specify: * **The URL** — the endpoint to call (required) * **The HTTP method** — GET, POST, PUT, PATCH, DELETE, or OPTIONS. The agent can often infer the method from context (e.g., "fetch" implies GET, "send data to" implies POST) * **Headers** — any custom headers like content type or authentication * **A request body** — for POST, PUT, and PATCH requests, describe the payload structure or provide exact values Here are some patterns that work well: **Fetching data:** ``` Retrieve the user profile from https://api.example.com/users/123 ``` **Sending data with a specific structure:** ``` POST the order to https://api.example.com/orders with a JSON body like: { "customerName": "", "items": [{"product": "", "quantity": , "price": }] } ``` **Including authentication:** ``` Fetch account details from https://api.example.com/account with the header Authorization: Bearer sk-example-a1b2c3d4e5f6 ``` **Using input values dynamically:** ``` Send the analysis results to https://hooks.example.com/results. Use the apiToken from the input as a Bearer token in the Authorization header. ``` > [!NOTE] > > The agent can also infer POST from natural phrasing like "send results to," > "submit data to," "notify the endpoint," or "push metrics to" — you don't > always need to specify the HTTP method explicitly. ## Using Responses The response of an HTTP request is available to the agent for use throughout the rest of the execution. You can provide instructions on how to use the results in plain text, just like any other part of your agent. For example: ``` Fetch the list of open issues from https://api.github.com/repos/acme/app/issues. Summarize the top 5 issues by priority and include them in the output. ``` The agent will make the request, read the response, and follow your instructions for how to process or present the data. ## Examples ### Fetching Data from an API An agent that retrieves weather information might include instructions like: ``` Check the current weather by making a GET request to https://api.weather.example.com/v1/current?city=San+Francisco with the header Accept: application/json. Include the temperature and conditions in your summary. ``` ### Posting to a Webhook An agent that sends notifications after processing: ``` After generating the report, notify the team by sending a POST request to https://hooks.example.com/services/T00/B00/xxxx with a JSON body: {"text": "New report generated: Q1 Sales Summary"} ``` ### Calling an Authenticated API An agent that reads from a protected endpoint using a bearer token: ```curl theme={null} curl -X GET https://api.example.com/account/details \ -H "Authorization: Bearer sk-example-a1b2c3d4e5f6" \ -H "Accept: application/json" ``` You can describe the equivalent in your agent as: ``` Fetch account details from https://api.example.com/account/details. Include the header Authorization: Bearer sk-example-a1b2c3d4e5f6 and set Accept to application/json. ``` ### Submitting Form Data An agent that submits structured data based on user input: ``` Submit the user's registration to https://api.example.com/signup with a JSON body containing the username, email, and subscribe fields from the input. ``` > [!NOTE] > > HTTP tools are not currently available under HIPAA-compliant configurations. ## Related Resources * [Using the API](/guides/integration-and-testing/api) — learn about the auto-generated API for your agents * [Integrating Your Agent](/guides/integration-and-testing/integration) — get started with agent integration * [Executing an Agent](/api-reference/executions/executing) — API reference for executing agents # MCP Client Integrations Source: https://docs.logic.inc/guides/tools/mcp-clients Connect your Logic agents to external MCP servers and third-party tools ## What are MCP Clients? MCP clients let your organization connect to external MCP servers, making third-party tools available to your Logic agents during execution. While Logic's [MCP server](/mcp/introduction) exposes your agents as tools for external AI platforms, MCP clients work in the opposite direction — they bring external tools *into* Logic. > [!NOTE] > > **MCP Server vs. MCP Client**: An MCP server lets external AI platforms (like > Claude or ChatGPT) call your Logic agents. An MCP client lets your Logic > agents call tools hosted on external MCP servers. > [!NOTE] > > MCP client integrations are not currently available for HIPAA-compliant > organizations. ## Creating an MCP Client You can create MCP clients from the **MCP Clients** section of your organization settings in the Logic dashboard. To add a new client: 1. Navigate to **Organization Settings > MCP Clients**. 2. Click **Add MCP Client**. 3. Fill in the required fields: * **Name** — A unique name for this client. * **URL** — The URL of the external MCP server. * **Description** — A brief description of what this client provides. * **(Optional) Auth Token** - An authentication Bearer token if required by the server (see below) 4. Click **Save**. ## Authentication MCP clients support three authentication types for connecting to external servers. You can configure the authentication method when creating or editing a client in the dashboard. ### None No authentication required. Use this for MCP servers that are publicly accessible or rely on network-level security. Leave the **Auth Token** section empty. ### Bearer Token Use this for MCP servers that require a secret token. Enter the token value in the dashboard. Logic will send it as a Bearer token in the `Authorization` header on each request. ### OAuth Logic will automatically detect MCP servers that use OAuth 2.0 authentication. Click the `Authorize` button to complete the OAuth workflow. Token information will be stored automatically upon success. > [!NOTE] > > Logic will automatically attempt to refresh OAuth tokens before they expire. > If automatic refresh fails, you can manually refresh tokens from the **MCP > Clients** page in your organization settings. ## Using MCP Clients with Agents Once you've created an MCP client, you need to connect it to the agents that should have access to its tools: 1. **Link the MCP client to your agent** — Open the agent in the Logic dashboard and add the MCP client from the agent's Tools panel. 2. **Update your agent contents** — In your agent, specify where and how the MCP client's tools should be used. The agent will have access to the linked tools during execution. ## Managing MCP Clients You can view, edit, and delete MCP clients from the **MCP Clients** section in your organization settings. From there you can update connection details, change authentication credentials, or remove clients that are no longer needed. ## Related Resources * [MCP Introduction](/mcp/introduction) — understand how Logic implements MCP * [MCP Quick Start](/mcp/quick-start) — get started with MCP # Observability Source: https://docs.logic.inc/guides/versions-and-history/observability Monitor execution stats, errors, and activity for your agents ## Observability Logic provides an observability dashboard for each agent, giving you a real-time view of how your agent is performing in production. You can open it from the agent editor using the **observability** icon in the top bar. ![observability](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_history.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=93cf237af2f61176febca96c14f5689c) ### Summary Stats At the top of the page you'll find high-level metrics for the selected time range: * **Total Runs** — the total number of executions * **Success Rate** — the percentage of executions that completed successfully * **Avg Latency** — the average time taken to execute the agent * **Active Issues** — the number of distinct errors currently occurring Use the time range buttons (**6h**, **24h**, **7d**, **30d**, **1y**) to adjust the window. ### Agent Activity A bar chart showing execution volume over time, helping you spot traffic spikes or drops at a glance. ### Success Rate & Latency Distribution A breakdown of successful vs. failed executions, alongside a latency histogram showing the spread of response times across your runs. ### Runs by Source Shows which sources (API, webhook, email, etc.) are triggering your agent, so you can understand where your traffic is coming from. ### Recent Errors A live feed of the most recent errors encountered during execution. Click any error to see more detail. ## Global Observability To see execution stats across all agents in your organization at once, click **View global observability** in the top right corner of the observability page. # Spec History Source: https://docs.logic.inc/guides/versions-and-history/spec-history Track and restore previous versions of your agent's spec ## Spec History Logic tracks every change made to your agent's spec, giving you a full audit trail of edits over time. You can open spec history using the **Spec history** icon in the agent editor's top bar. ![spec history](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/agent_versions.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=1a160c1fe5ab28528b99c71dfb321520) ### Viewing Past Versions The **Spec History** panel lists previous versions of your agent's spec in reverse chronological order. Click any entry to view that version of the spec alongside the current one. ### Restoring a Version You can restore a previous version of your agent's spec directly from the Spec History panel. Logic will prompt you to confirm before applying the change. # Agent Scope Source: https://docs.logic.inc/mcp/agent-scope Control which Logic agents are accessible through your MCP server ## Understanding Agent Scope When you create an MCP server, you choose which Logic agents it can access. Logic provides two scope options: **All Agents** and **Limited**. This determines which agents AI platforms can execute through the server. > [!NOTE] > > Scope controls *which* agents a server reaches. A separate **permission** > setting controls *what* a client can do with them (run only, or also create > and edit). See [Built-in Tools](/mcp/built-in-tools) for permissions. ## Scope Types ### All Agents Scope Access to **all agents** in your organization, including future agents. New agents are automatically available without configuration. Best for internal tools where you trust all content to be accessible. ### Limited Scope Access to **only agents you explicitly assign**. You control exactly which agents are exposed. Best for external sharing, testing environments, or when you need fine-grained control. Note that new agents must be manually added. ## Next Steps * [Create your first MCP server](/mcp/quick-start) * [Learn about async task execution](/mcp/async-tasks) * [Connect to an AI platform](/mcp/quick-start#step-4%3A-connect-to-an-ai-platform) # Asynchronous Task Execution Source: https://docs.logic.inc/mcp/async-tasks Handle long-running Logic workflows efficiently with async MCP support ## Overview Logic MCP servers support asynchronous task execution, allowing AI platforms to start long-running tasks without blocking while they complete. Instead of waiting for completion, the AI platform receives an execution ID and can check back later for results. ## How It Works When an AI platform executes a Logic agent through MCP: 1. **Task starts immediately** - Logic begins processing 2. **Execution ID returned** - AI platform receives a unique identifier 3. **Status checking** - Use the `_logic_check_execution_status` tool with the execution ID 4. **Results retrieved** - When complete, the tool returns the output > [!NOTE] > > `_logic_check_execution_status` is one of Logic's [built-in > tools](/mcp/built-in-tools). In most clients it shows up with a `Logic:` > prefix (for example, **Logic: Check Execution Status**), the same naming used > for **Logic: Call Agent**, which starts the run this tool polls. It's distinct > from **View executions** (`_logic_view_executions`), which lists an agent's > past runs rather than tracking a single in-flight one. ### Example Flow ``` AI Platform → Start Logic agent execution Logic MCP → Returns execution_id: "exec_abc123" AI Platform → _logic_check_execution_status("exec_abc123") Logic MCP → Status: "in_progress" [wait a bit] AI Platform → _logic_check_execution_status("exec_abc123") Logic MCP → Status: "success" + results ``` ## Running Multiple Tasks The async model enables parallel execution. AI platforms can: * Start multiple Logic agents simultaneously * Poll each execution ID separately * Retrieve results as each task completes **Example**: Process 10 images in parallel instead of sequentially * Without async: 10 × 30 seconds = 5 minutes total * With async: \~30 seconds total (parallelized) ## Platform Support Different AI platforms handle async tasks automatically: * **Claude platforms**: Automatically poll and manage multiple executions * **ChatGPT**: Check platform documentation for async behavior * **Custom clients**: Call the `_logic_check_execution_status` tool and implement polling logic ## Next Steps * [Built-in Tools](/mcp/built-in-tools) - The full set of `Logic:` tools, including the status check * [Review agent scope](/mcp/agent-scope) - Control which agents support async execution * [Explore integrations](/mcp/quick-start#step-4%3A-connect-to-an-ai-platform) - See how platforms handle async tasks # Built-in Tools Source: https://docs.logic.inc/mcp/built-in-tools What a connected MCP client can do with your Logic agents ## Overview Every Logic MCP connection provides a set of **built-in tools** that let a connected AI client discover, run, inspect, and even build your Logic agents on your behalf — without switching back to the Logic dashboard. Your agents aren't exposed as individual client tools. Instead, a client reaches them through these built-in tools — for example, **Logic: List Agents** to find an agent and **Logic: Call Agent** to run it. In your client, the built-in tools appear at the top of the list with a `Logic:` prefix (for example, **Logic: List Agents**). Under the hood each has a raw tool ID — some clients and logs show that instead — so the entries below pair the display name with its ID. What a client can do depends on the **permission** you give the MCP server when you create or edit it: | Permission | What a client can do | | - | - | | **Execute only** | Discover, run, and inspect existing agents | | **Author** | Everything above, plus create and edit agents | > [!NOTE] > > Creating and editing agents is only available on servers set to **Author** > permission. A server set to **Execute only** can read and run your agents but > can't change them — Logic enforces this on the server, no matter what the > client requests. ## Read & execute Available on every connection: * **List agents** (`_logic_list_agents`) — see all your agents, including drafts. This is how a client discovers what's available to run; newly created or edited agents show up here immediately. * **Read an agent** (`_logic_read_agent`) — view its spec, the input it expects, and every way it can be triggered (email address, REST endpoint, MCP server, and schedules). * **View executions** (`_logic_view_executions`) — review recent runs and their results to see what succeeded or failed, and why. * **Call an agent** (`_logic_call_agent`) — run any agent by name. Since agents aren't exposed as individual tools, this is how a client executes them. Runs are asynchronous, so the client polls **Check execution status** (`_logic_check_execution_status`) until the result is ready — see [Asynchronous Task Execution](/mcp/async-tasks). > [!NOTE] > > Runs are asynchronous, so a result isn't always instant — the assistant checks > back on its own (by polling `_logic_check_execution_status`) until the run > finishes, which can take a few minutes for longer workflows. An **Execute > only** server sees only the runs it started; an **Author** server sees all of > an agent's runs. ## Authoring Available on servers set to **Author** permission: * **Create an agent** (`_logic_create_agent`) — turn a title and a spec into a new agent. * **Edit an agent** (`_logic_patch_agent`) — update an existing agent's spec with targeted find-and-replace edits, and optionally rename it. New and edited agents are saved as a **draft** by default. The client can publish in the same step to make the agent **live** and callable right away; otherwise your published version keeps running unchanged until you choose to publish. > [!NOTE] > > When the assistant creates or publishes an agent, it's available right away — > it shows up in **Logic: List Agents** immediately and can be run with **Logic: > Call Agent**, with no need to reconnect or restart the client. ## Next Steps * [Agent Scope](/mcp/agent-scope) — control which agents a server exposes * [Asynchronous Task Execution](/mcp/async-tasks) — how long-running results come back * [Connect to an AI platform](/mcp/quick-start#step-4%3A-connect-to-an-ai-platform) # ChatGPT Integration Source: https://docs.logic.inc/mcp/integrations/chatgpt Connect Logic MCP servers to ChatGPT ## Important Limitations > [!WARNING] > > **Developer Mode Required** > > ChatGPT requires "Developer mode" to add custom MCP servers. This has significant limitations: > > * **Not available on organization accounts** in many cases > * May enable other experimental features beyond just MCP > * Limited support from OpenAI for custom MCP servers ## Prerequisites * ChatGPT account (developer mode often unavailable on org accounts) * Logic MCP server created ([Quick Start guide](/mcp/quick-start)) * Server URL from Logic organization settings ## Configuration ### Enabling Developer Mode 1. **Open ChatGPT Settings** 2. **Navigate to "Apps"** 3. **Select "Advanced settings"** 4. **Enable "Developer mode"** > [!WARNING] > > Enabling developer mode may activate other experimental features beyond MCP > support. Review what this means for your account before proceeding. ### Adding Your Logic MCP Server Once developer mode is enabled: 1. **In the Apps section**, select **"Create app"** 2. **Configure your Logic MCP integration:** * **Name**: Enter a descriptive name for your Logic integration * **MCP URL**: Paste the server URL from your [Logic organization settings](https://app.logic.inc/settings/organization-settings/mcp-servers) * **Authentication**: Select **"No Auth"** Your Logic MCP server is now configured in ChatGPT. ## Using Logic Agents ### Enabling Your Logic Integration To use Logic agents in a conversation: 1. **Start a new chat or open an existing conversation** 2. **Click the "+" button** in the chat interface 3. **Under "More"**, select your Logic MCP integration 4. **Verify the integration is active:** * The integration name should appear in the chat text box * The text box will change to orange, indicating developer mode is active Once enabled, ChatGPT can access and execute your Logic agents. ### Testing Your Connection Try asking ChatGPT to use one of your Logic agents: * "What Logic agents are available?" * "Run the \[agent name] Logic agent" ChatGPT will execute the agent and return the results in the conversation. ## Troubleshooting **Cannot find developer mode?** * Developer mode may not be available on your account type * Organization/business accounts often have this feature restricted * Try using a personal ChatGPT account if available **Integration not appearing after creation?** * Refresh the ChatGPT page * Verify developer mode is still enabled * Check that the MCP URL was copied correctly ## Next Steps * [Review agent scope](/mcp/agent-scope) - Control which agents are accessible * [Explore async tasks](/mcp/async-tasks) - Handle long-running Logic agents # Claude Code CLI Integration Source: https://docs.logic.inc/mcp/integrations/claude-code Connect Logic MCP servers to Claude Code command-line interface ## Overview Claude Code is Anthropic's CLI tool for AI-assisted software development. You can connect your Logic MCP server to make Logic agents available during coding sessions. ## Prerequisites * **Claude Code CLI** installed ([installation guide](https://claude.com/claude-code)) * **Logic MCP server** created ([Quick Start guide](/mcp/quick-start)) * **Server URL** from Logic organization settings ## Adding Logic MCP Server ### Using Claude Code Commands > [!NOTE] > > **Important**: Run this command in your terminal, not within a Claude Code > session. Add your Logic MCP server using the `claude mcp add` command: ```bash theme={null} claude mcp add --transport http [SERVER_NAME] [MCP_SERVER_URL] ``` **Parameters:** * `--transport http` - Required for HTTP-based MCP servers like Logic * `[SERVER_NAME]` - A name to identify this server (e.g., "logic-docs") * `[MCP_SERVER_URL]` - Your Logic MCP server URL from [organization settings](https://app.logic.inc/settings/organization-settings/mcp-servers) ### Managing MCP Servers **List configured servers:** ```bash theme={null} claude mcp list ``` **Remove a server:** ```bash theme={null} claude mcp remove [SERVER_NAME] ``` ## Using Logic Agents Once configured, Logic agents are available in your Claude Code sessions. ### Verifying Your Connection To check if your Logic MCP server is connected: 1. **Start a Claude Code session** 2. **Type `/mcp`** in your chat 3. **Verify your Logic server shows as connected** If the server appears and shows a connected status, Logic agents are available for use. ### Accessing Logic Agents Claude Code can automatically access your Logic agents based on the conversation context. You can: * Ask Claude Code to use specific Logic agents by name * Let Claude Code discover and suggest relevant Logic agents * Execute Logic agents with parameters as needed **Example usage:** ``` Can you run the "code-review" Logic agent on the current branch? ``` Claude Code will execute the Logic agent and incorporate the results into its response. > [!NOTE] > > Long-running Logic agents are handled asynchronously. Learn more about > [async task execution](/mcp/async-tasks). ## Next Steps * [Learn about async tasks](/mcp/async-tasks) - Handle long-running Logic agents * [Explore agent scope](/mcp/agent-scope) - Control tool availability # Claude Desktop Integration Source: https://docs.logic.inc/mcp/integrations/claude-desktop Connect Logic MCP servers to Claude desktop application ## Overview Claude desktop app supports MCP servers, allowing you to access your Logic agents directly from conversations with Claude. ## Prerequisites * **Claude desktop app** installed ([download here](https://claude.com/download)) * **Logic MCP server** created ([Quick Start guide](/mcp/quick-start)) * **Server URL** from Logic organization settings ## Adding Logic MCP Server ### Through Claude Desktop UI 1. **Open the Claude desktop app** 2. **Click your profile** in the bottom left corner 3. **Select Settings** from the menu 4. **Navigate to the "Connectors" tab** 5. **Click "Add custom connector"** 6. **Enter your Logic MCP server details:** * **Name**: A descriptive name for your Logic integration * **URL**: Paste the MCP server URL from your [Logic organization settings](https://app.logic.inc/settings/organization-settings/mcp-servers) Your Logic MCP server is now connected to Claude desktop. ## Using Logic Agents Once configured, your Logic agents are available in Claude conversations. ### Enabling Your Logic Connector To use Logic agents in a conversation: 1. **Start a new chat or open an existing conversation** 2. **Click the "+" button** in the chat interface 3. **Under "Connectors"**, locate your Logic MCP integration 4. **Enable the connector** to make Logic agents available in this conversation Once enabled, Claude can access and execute your Logic agents based on your MCP server's [agent scope](/mcp/agent-scope). ### Testing Your Connection Try asking Claude to use one of your Logic agents: * "Can you show me what Logic agents are available?" * "Run the \[agent name] Logic agent with \[parameters]" Claude will execute the agent and return the results in the conversation. ## Next Steps * [Learn about agent scope](/mcp/agent-scope) - Control which agents Claude can access * [Explore async tasks](/mcp/async-tasks) - Understand how Claude handles long-running agents # Codex CLI Integration Source: https://docs.logic.inc/mcp/integrations/codex Connect Logic MCP servers to Codex command-line interface ## Overview Codex is an AI-powered CLI tool for software development. You can connect your Logic MCP server to make Logic agents available during coding sessions. ## Prerequisites * **Codex CLI** installed * **Logic MCP server** created ([Quick Start guide](/mcp/quick-start)) * **Server URL** from Logic organization settings ## Adding Logic MCP Server ### Using Codex Commands > [!NOTE] > > **Important**: Run this command in your terminal, not within a Codex session. Add your Logic MCP server using the `codex mcp add` command: ```bash theme={null} codex mcp add [SERVER_NAME] --url [MCP_SERVER_URL] ``` **Parameters:** * `[SERVER_NAME]` - A name to identify this server (e.g., "logic-docs") * `--url [MCP_SERVER_URL]` - Your Logic MCP server URL from [organization settings](https://app.logic.inc/settings/organization-settings/mcp-servers) ### Managing MCP Servers **List configured servers:** ```bash theme={null} codex mcp list ``` **Remove a server:** ```bash theme={null} codex mcp remove [SERVER_NAME] ``` ## Using Logic Agents Once configured, Logic agents are available in your Codex sessions. ### Verifying Your Connection To check if your Logic MCP server is connected: 1. **Start a Codex session** 2. **Type `/mcp`** in your chat 3. **Verify your Logic server shows as "enabled"** If the server appears with an enabled status, Logic agents are available for use. ### Accessing Logic Agents Codex can automatically access your Logic agents based on the conversation context. You can: * Ask Codex to use specific Logic agents by name * Let Codex discover and suggest relevant Logic agents * Execute Logic agents with parameters as needed **Example usage:** ``` Can you run the "code-review" Logic agent on the current branch? ``` Codex will execute the Logic agent and incorporate the results into its response. > [!NOTE] > > Long-running Logic agents are handled asynchronously. Learn more about > [async task execution](/mcp/async-tasks). ## Next Steps * [Learn about async tasks](/mcp/async-tasks) - Handle long-running Logic agents * [Explore agent scope](/mcp/agent-scope) - Control tool availability # Cursor Integration Source: https://docs.logic.inc/mcp/integrations/cursor Connect Logic MCP servers to the Cursor code editor ## Overview Cursor is an AI-powered code editor with built-in MCP support. You can connect your Logic MCP server to make Logic agents available while you code. ## Prerequisites * **Cursor** installed ([download here](https://cursor.com)) * **Logic MCP server** created ([Quick Start guide](/mcp/quick-start)) * **Server URL** from Logic organization settings ## Adding Logic MCP Server ### Using Cursor Settings 1. Open **Cursor Settings → Tools & MCP** 2. Select **New MCP Server** — this opens your `mcp.json` 3. Add your Logic server under `mcpServers` and save: ```json theme={null} { "mcpServers": { "logic": { "url": "[MCP_SERVER_URL]" } } } ``` **Parameters:** * `"logic"` - A name to identify this server * `"url"` - Your Logic MCP server URL from [organization settings](https://app.logic.inc/settings/organization-settings/mcp-servers) > [!NOTE] > > Logic exposes a Streamable HTTP endpoint, so only the `url` field is required > — no command or transport flag. ### Editing the config directly You can also edit the config file yourself, at either scope, using the same `mcpServers` entry shown above: * **Project** — `.cursor/mcp.json` in your project root (available only in that project) * **Global** — `~/.cursor/mcp.json` in your home directory (available in every project) ### Managing MCP Servers Open **Cursor Settings → Tools & MCP** to view registered servers, and toggle Logic on or off. To remove it entirely, delete its entry from `mcp.json`. ## Using Logic Agents Once configured, Logic agents are available in Cursor's chat. ### Verifying Your Connection 1. **Open Cursor Settings → Tools & MCP** 2. **Find your Logic server** in the list 3. **Confirm it shows as enabled** with its tools listed If the server appears and its tools are listed, Logic agents are available for use. You can also check **Output → MCP Logs** (⇧⌘U) for connection status. ### Accessing Logic Agents Cursor can automatically access your Logic agents based on the conversation context. You can: * Ask Cursor to use specific Logic agents by name * Let Cursor discover and suggest relevant Logic agents * Execute Logic agents with parameters as needed **Example usage:** ``` Can you run the "code-review" Logic agent on the current branch? ``` Cursor will execute the Logic agent and incorporate the results into its response. > [!NOTE] > > Long-running Logic agents are handled asynchronously. Learn more about [async > task execution](/mcp/async-tasks). ## Next Steps * [Learn about async tasks](/mcp/async-tasks) - Handle long-running Logic agents * [Explore agent scope](/mcp/agent-scope) - Control tool availability # VS Code Integration Source: https://docs.logic.inc/mcp/integrations/vscode Connect Logic MCP servers to VS Code with GitHub Copilot ## Overview VS Code supports MCP servers through GitHub Copilot's agent mode. You can connect your Logic MCP server to make Logic agents available while you code. ## Prerequisites * **VS Code** with **GitHub Copilot** ([download here](https://code.visualstudio.com)) * **Logic MCP server** created ([Quick Start guide](/mcp/quick-start)) * **Server URL** from Logic organization settings ## Adding Logic MCP Server ### Using the Command Palette 1. Open the Command Palette (⇧⌘P) 2. Run **MCP: Add Server** 3. Choose **HTTP** as the server type and paste your Logic **Server URL** 4. Select **Workspace** (this project only) or **Global** (all projects) ### Editing the config directly VS Code stores workspace MCP servers in `.vscode/mcp.json`. You can add Logic under `servers`: ```json theme={null} { "servers": { "logic": { "type": "http", "url": "[MCP_SERVER_URL]" } } } ``` **Parameters:** * `"logic"` - A name to identify this server * `"type": "http"` - Required for HTTP-based MCP servers like Logic * `"url"` - Your Logic MCP server URL from [organization settings](https://app.logic.inc/settings/organization-settings/mcp-servers) ## Using Logic Agents Logic agents are available in Copilot Chat's **agent mode**. ### Verifying Your Connection 1. **Open the Chat view** (⌃⌘I) and switch the mode to **Agent** 2. **Select the Configure Tools button** in the chat input 3. **Confirm your Logic server and its tools appear** in the list If the server appears and its tools are listed, Logic agents are available for use. You can toggle individual tools on or off from the same menu. ### Accessing Logic Agents Copilot can automatically access your Logic agents based on the conversation context. You can: * Ask Copilot to use specific Logic agents by name * Let Copilot discover and suggest relevant Logic agents * Execute Logic agents with parameters as needed **Example usage:** ``` Can you run the "code-review" Logic agent on the current branch? ``` Copilot will execute the Logic agent and incorporate the results into its response. > [!NOTE] > > Long-running Logic agents are handled asynchronously. Learn more about [async > task execution](/mcp/async-tasks). ## Next Steps * [Learn about async tasks](/mcp/async-tasks) - Handle long-running Logic agents * [Explore agent scope](/mcp/agent-scope) - Control tool availability # MCP Introduction Source: https://docs.logic.inc/mcp/introduction Understanding Logic's Model Context Protocol server implementation ## What is MCP? The Model Context Protocol (MCP) is an open standard that enables AI applications to securely connect to external data sources and tools. Logic implements MCP as a server, allowing you to connect AI platforms like Claude, Codex, and ChatGPT directly to your Logic agents. With Logic's MCP server, you write your AI rules and workflows once in Logic, and any MCP-compatible tool can use them. ## How Logic Implements MCP Logic provides MCP servers at the organization level. Each MCP server: * **Makes your Logic agents available** for AI assistants to discover and run * **Provides built-in tools** to discover, run, inspect, and — with the right permission — create and edit agents * **Manages agent access** through flexible scope and permission controls * **Supports async execution** for long-running workflows * **Handles authentication** automatically ## Key Features ### Secure Access Control Choose which agents to expose through each MCP server, and what clients can do with them: * **Scope**: expose every agent (**All Agents**) or only selected ones (**Limited**) * **Permission**: let clients run agents (**Execute only**) or also create and edit them (**Author**) ### Built-in Tools Every connection includes [built-in tools](/mcp/built-in-tools) — the way a client discovers, runs, and inspects your agents, and, on **Author** servers, creates and edits them — all without leaving the chat. ### Async Task Support Logic MCP servers support asynchronous task execution, meaning AI assistants can start long-running Logic workflows and check back for results without blocking. This enables: * Parallel execution of multiple Logic agents * Handling of complex, time-intensive workflows * Better resource utilization ### Platform Compatibility Logic's MCP implementation works with major AI platforms: * Claude (desktop and CLI) * Codex CLI * ChatGPT * Any other MCP-compatible client ## Use Cases **Code Style Validation**: Create a Logic agent that validates code against your company's style guide. Connect it via MCP to Claude Code, and automatically check your code as you write. **Data Analysis Pipeline**: Build a Logic agent that analyzes data and generates reports. Connect it to ChatGPT so you can run analyses conversationally. **Multi-Step Workflows**: Design complex Logic workflows that AI assistants can trigger and monitor, enabling sophisticated automation without custom integration code. ## Getting Started Ready to connect your Logic agents to AI platforms? > [!NOTE] > > Start with the [Quick Start](/mcp/quick-start) guide to create your first MCP > server and connect it to an AI platform. # MCP Quick Start Source: https://docs.logic.inc/mcp/quick-start Create your first Logic MCP server in minutes ## Creating Your First MCP Server This guide will walk you through creating an MCP server and connecting it to an AI platform. ### Prerequisites Before you begin, make sure you have: * Organization administrator access (for creating MCP servers) * An MCP-compatible AI platform (such as Claude, ChatGPT, or Codex) ## Step 1: Navigate to MCP Servers Click the **Servers** icon (the stacked-servers icon) in the left sidebar to open the MCP Servers page. ![MCP servers settings page](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/MCP_servers.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=db283db0e6e169ea277a785481ffcaf2) ## Step 2: Create a New MCP Server Click the **Create Server** button to begin setup. ### Configure Your Server You'll need to provide: **Server Name** (required) * A descriptive name for this MCP server (1-100 characters) * Example: "Engineering Team Agents" or "Production Workflows" **Description** (optional) * Additional context about what this server provides (up to 500 characters) * This helps team members understand the server's purpose **Agent Scope** (required) * Choose how this server accesses your agents: * **All Agents**: All current and future agents in your organization * **Limited**: Only specific agents you select > [!NOTE] > > Not sure which scope to choose? See the [Agent Scope](/mcp/agent-scope) guide > for detailed recommendations. **Permission** (required) * Choose what connected clients are allowed to do: * **Execute only**: Clients can discover, run, and inspect your agents * **Author**: Clients can also create and edit agents on your behalf > [!NOTE] > > Permission controls *what* a client can do; scope controls *which* agents it > can reach. See [Built-in Tools](/mcp/built-in-tools) for the full breakdown. ### Select Agents (Limited Scope Only) If you chose Limited scope, select which agents this server can access. You can: * Search for agents by name * Select multiple agents * Add or remove agents later ![MCP servers select which agents are accessible](https://mintcdn.com/logic/JFme65otZYsTtNer/screenshots/MCP_servers_select_agents.png?fit=max\&auto=format\&n=JFme65otZYsTtNer\&q=85\&s=ac14718b8eafa0a29a10334af42e3b22) ## Step 3: Copy Your Server URL After creating the server, Logic generates a unique connection URL that AI platforms use to connect to your MCP server. Copy the URL - you'll need it to configure your AI platform in the next step. ## Step 4: Connect to an AI Platform Now that you have your MCP server URL, connect it to an AI platform: > **[Claude Desktop](/mcp/integrations/claude-desktop)** > > Configure Claude desktop app > **[Claude Code](/mcp/integrations/claude-code)** > > Set up Claude Code CLI > **[Codex](/mcp/integrations/codex)** > > Set up Codex CLI > **[Cursor](/mcp/integrations/cursor)** > > Set up the Cursor editor > **[VS Code](/mcp/integrations/vscode)** > > Set up VS Code with Copilot > **[ChatGPT](/mcp/integrations/chatgpt)** > > Set up ChatGPT with developer mode ## Step 5: Test Your Connection Once connected, test that your AI platform can access your Logic agents: 1. Open your AI platform 2. Look for your Logic agents in the available tools/functions 3. Try executing a simple Logic agent 4. Verify you receive the expected response ## Next Steps Now that your MCP server is running: * **Learn about [Agent Scope](/mcp/agent-scope)** - Optimize which agents are accessible * **Explore [Async Tasks](/mcp/async-tasks)** - Handle long-running workflows efficiently > [!NOTE] > > Need help? Check the platform-specific integration guides for detailed setup > instructions and troubleshooting.