### Get Started with Agent Networks Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/agent-networks-get-started.adoc This snippet shows how to get started with agent networks. It requires the Anypoint Code Builder. ```adoc include::anypoint-code-builder::partial$af-shared.adoc[tag=get-started] ``` -------------------------------- ### Example Navigation Questions for AI Assistant Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/exp-ai-assistant-use.adoc Use the AI assistant to navigate the platform, find features, or get guidance on tasks. ```text How do I register a new API? ``` ```text Show me the governance strategies page ``` ```text Take me to monitoring for my agent ``` ```text Where do I configure scanners? ``` -------------------------------- ### Send GET Request to Local API Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/api-led-test.adoc Send a GET request to your locally running API to test its basic functionality. Ensure your application is started before sending the request. ```text http://localhost:8081/api/greeting?name=World ``` -------------------------------- ### Example Portfolio Questions for AI Assistant Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/exp-ai-assistant-use.adoc Ask the AI assistant questions about your portfolio, such as finding agents, APIs, or instances. ```text Show me all agents in production ``` ```text Which APIs have governance violations? ``` ```text Find MCP servers that expose payment tools ``` ```text What instances are deployed to the staging gateway? ``` -------------------------------- ### Publish Mule App to Anypoint Exchange Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/api-led-develop-old.adoc This dialog guides you through the process of publishing your Mule application as an example to Anypoint Exchange, making it available for others. ```text User: Business group: My Top Business Group Version: Project type: Example ``` -------------------------------- ### Example Cost Questions for AI Assistant Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/exp-ai-assistant-use.adoc Query the AI assistant regarding token spend, cost optimization, and usage trends. ```text What's my total token spend this month? ``` ```text Which agents are using the most tokens? ``` ```text How can I reduce costs for my LLM proxies? ``` ```text Show me cost trends over time ``` -------------------------------- ### Test API from Anywhere Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/api-led-operate.adoc This is an example URL to test your deployed API from any device or application. Replace 'your-app-url.cloudhub.io' with your actual application URL. ```text https://your-app-url.cloudhub.io/api/greeting?name=World ``` -------------------------------- ### Example Monitoring Questions for AI Assistant Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/exp-ai-assistant-use.adoc Ask the AI assistant about service performance, error rates, latency, health alerts, and token usage. ```text What's the error rate for my agent today? ``` ```text Show me latency trends for the last week ``` ```text Which services have the highest token usage? ``` ```text Are there any service health alerts? ``` -------------------------------- ### RAML for Hello World API Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/api-led-design-old.adoc This RAML specification defines a simple 'hello-world-api' with a GET endpoint for greetings and includes examples for success and error responses. ```raml #%RAML 1.0 title: hello world version: v1 description: A greeting for the world types: greeting: properties: todays-greeting: string /greeting: get: responses: 200: body: application/json: type: greeting example: {todays-greeting: "test-greeting"} 404: body: application/json: properties: message: string example: | { "message" : "Greeting not found" } ``` -------------------------------- ### Example Governance Questions for AI Assistant Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/exp-ai-assistant-use.adoc Inquire about governance strategies, violations, policies, and compliance status using the AI assistant. ```text What governance strategies are active? ``` ```text How do I create a new governance strategy? ``` ```text Show me all services with security violations ``` ```text Which policies are applied to my API instance? ``` -------------------------------- ### Mocking Service Response Example Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/api-led-design.adoc This JSON snippet represents a successful response from the API Console's Mocking Service, confirming the expected output for a given input. ```json { "message": "Hello, World!" } ``` -------------------------------- ### APIkit Request Handling Flow Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/_partials/mule-runtime-metrics.adoc This flow demonstrates how APIkit routes incoming requests and handles a GET request for the /reservation path. It includes a logger to capture query parameters. ```xml ``` -------------------------------- ### Test API Endpoint Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/api-led-develop-old.adoc Use a REST client to send a GET request to the deployed API endpoint to verify its functionality and response. ```http GET http://localhost:8081/api/greeting ``` -------------------------------- ### OpenAPI 3.0 Specification for a Simple API Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/api-led-design.adoc This YAML snippet defines a basic OpenAPI 3.0 specification for a 'hello-world-api' with a GET endpoint that accepts a 'name' query parameter and returns a JSON greeting. ```yaml openapi: 3.0.0 info: title: hello-world-api version: 1.0.0 paths: /greeting: get: parameters: - name: name in: query required: true schema: type: string description: The name to greet responses: '200': description: Success content: application/json: schema: type: object properties: message: type: string example: "Hello, World!" ``` -------------------------------- ### Mule Flow with Only a Logger Component Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/usage-metrics.adoc This example demonstrates a Mule flow that contains only a logger component. Such flows, lacking an event source and not used for APIkit routing, are not charged against the Anypoint Platform package allotment. ```xml 2.a - Flow with only a logger component ``` -------------------------------- ### Non-Billable Mule Flow Example Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/_partials/mule-runtime-metrics.adoc An example of a Mule flow that does not count against Anypoint Platform package allotments. This flow contains only a logger component and is used for modularizing code. ```xml ``` -------------------------------- ### Implement Hello World Greeting Logic Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/api-led-develop.adoc This DataWeave script transforms the request to return a personalized greeting using a query parameter. It's used within the API implementation flow. ```dataweave %dw 2.0 output application/json --- { message: "Hello, " ++ attributes.queryParams.name ++ "!" } ``` -------------------------------- ### Run MUnit Tests for Java 17 Compatibility Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/_partials/partner-and-customer-guide.adoc Execute MUnit tests using Maven, specifying compatible versions for the Mule runtime, MUnit, and the Mule Maven plugin. This command helps verify your connector's compatibility with Java 17. ```bash mvn -f pom.xml -s ~/.m2/settings.xml -Dapp.runtime=4.6.0 -Dmunit.version=3.1.0 -Dmule.maven.plugin.version=4.1.0 -fae test ``` -------------------------------- ### Test Deployed API Request Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/api-led-deploy-old.adoc Send a GET request to the base URI of your deployed CloudHub application, including the API endpoint, to test the deployment. ```http GET http://hello-world-greeting.sandy-kim.us-e2.cloudhub.io/api/greeting ``` -------------------------------- ### Bash Script for Testing Illegal Reflective Access Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/_partials/partner-and-customer-guide.adoc Execute this bash script to run MTF tests with the '--illegal-access=deny' parameter. Replace the runtime version and JVM path as needed. The output is logged to target/test.log. ```bash #!/bin/bash RUNTIME_VERSION=4.6.0 MUNIT_JVM=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java mvn clean mkdir target mvn verify \ -DruntimeProduct=MULE_EE \ -DruntimeVersion=$RUNTIME_VERSION \ -Dmunit.jvm=$MUNIT_JVM \ -Dmtf.javaopts="--illegal-access=deny" > ./target/test.log ``` -------------------------------- ### Configure mtf.javaopts Property Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/_partials/partner-and-customer-guide.adoc Add an empty property to your pom.xml to configure MTF Java options. This is a prerequisite for setting JVM parameters for reflective access. ```xml ``` -------------------------------- ### Configure External Library with JDBC Driver Source: https://github.com/mulesoft/docs-general/blob/latest/modules/ROOT/pages/_partials/partner-and-customer-guide.adoc This snippet shows how to configure an external library, specifically a MySQL JDBC driver, using annotations. Ensure the coordinates match the required version for Java 17 compatibility. ```java @ExternalLib(name = "MySQL JDBC Driver", description = "A JDBC driver that supports connection to the MySQL Database", nameRegexpMatcher = "(.*)\.jar", requiredClassName = "com.mysql.jdbc.Driver", coordinates = "mysql:mysql-connector-java:5.1.44") public class MySqlConnectionProvider implements ConnectionProvider { // } ```