Best practices
Follow these best practices to use the API Agent extension in Visual Studio Code or IBM API Studio, effectively. Ensure that the extension window is full height and at least one third of the Visual Studio Code window for optimal performance.
Guidelines for using prompts
To achieve accurate and efficient results, use the following guidelines when you enter the prompt:
- Avoid the words or tone that convey sarcasm or humor, as they can be misinterpreted.
- Use active voice, correct grammar, spelling, and keep your request clear and specific.
- Provide clear context and relevant keywords, and avoid vague or domain-specific terms. For
example,
generate testorbuild API. - If the system is unable to understand your request, it offers suggestions for the requests.
- Use the following sample prompts to get accurate answers:
- For documentation search, enter the prompt:
Search the documentation for. - For critical details,
Cross-check with official IBM documentation before implementing. - Include version number in your query for specific product version.
- If answers are different cross-check with official documents.
- For documentation search, enter the prompt:
Prerequisites
The API Agent plug-in can be used to complete tasks that are related to API Connect.
- Ensure that you are logged in to API Agent. For login and operation instructions, see Getting started.
- You must have valid permissions to use the API Agent. For more information, see API Agent user roles.
- Ensure that you have the same permissions through the API Connect’s API Manager interface. Even if you have permission to use the API Agent plug-in, actions fail if you do not have the necessary permissions to complete the same tasks through the API Manager UI.
Understanding prompts in documentation
- Replace placeholders in commands
- If a command contains a placeholder such as
[apiName], replace it with your API name.- Command
Run test cases for [apiName]:[version] - Replacement
Run test cases for bookshop-api-3:1.0
- Command
- Populate the placeholder such as
[@file] - The document might have the following prompt:
remediate api [@file] using spectral-owasp ruleset. Replace it withremediate api @bookstore.yaml using spectral-owasp ruleset.
For more information about common issues, see Troubleshooting.
The following sections provide steps to start a new session with the API Agent, including clearing temporary data, refreshing the system, and logging out of the current session.
Sequential prompts
Use API Agent to
chain multiple tools together in a single prompt and then run one after another. The following are
examples of sequential prompts:
- Create and run test cases
-
create test cases for the petstore api and run the test cases
- List published APIs or products
-
list apis, products, published apis and published productsOrlist published apis
- Create an API and generate FastAPI server code
-
create api from file @openapi.yaml and generate fastapi server code from the same api fileOrcreate api using @file_name - Review security of an API
-
review security of api API_NAME:VERSIONOrvalidate api API_NAME:VERSION