The Asteroid Odyssey TypeScript SDK provides a simple way to interact with the Asteroid Agents API for triggering and monitoring agent executions, checking statuses, and retrieving results.
Agent Creation: Agents can only be created through the Asteroid Platform web interface. The API is designed for executing existing agents, not creating them.
Install Dependencies
Install the required packages:
Create Your File
Create a new file called example.ts
and add this code:
Run Your Code
Run the example using ts-node:
Replace YOUR_API_KEY
with your actual API key and YOUR_AGENT_ID
with the ID of an agent you’ve created in the Asteroid Platform.
The executeAgent
function takes:
client
: The configured API clientagentId
: The ID of the agent to execute (found in the Asteroid platform)executionData
: An object containing prompt variables that will be inserted into your agent’s prompt templateThe example agent used in this documentation has a {{.DATA}}
prompt variable configured, which is why our examples use the DATA
parameter.
When you create an agent, you define a prompt template with variables like {{.DATA}}
. The values you pass to executeAgent
replace these variables.
Example Agent Prompt:
Execution Call:
Resulting Prompt (what the agent sees):
Common Issues:
For more help, visit the Asteroid Platform or check your execution logs there.
The Asteroid Odyssey TypeScript SDK provides a simple way to interact with the Asteroid Agents API for triggering and monitoring agent executions, checking statuses, and retrieving results.
Agent Creation: Agents can only be created through the Asteroid Platform web interface. The API is designed for executing existing agents, not creating them.
Install Dependencies
Install the required packages:
Create Your File
Create a new file called example.ts
and add this code:
Run Your Code
Run the example using ts-node:
Replace YOUR_API_KEY
with your actual API key and YOUR_AGENT_ID
with the ID of an agent you’ve created in the Asteroid Platform.
The executeAgent
function takes:
client
: The configured API clientagentId
: The ID of the agent to execute (found in the Asteroid platform)executionData
: An object containing prompt variables that will be inserted into your agent’s prompt templateThe example agent used in this documentation has a {{.DATA}}
prompt variable configured, which is why our examples use the DATA
parameter.
When you create an agent, you define a prompt template with variables like {{.DATA}}
. The values you pass to executeAgent
replace these variables.
Example Agent Prompt:
Execution Call:
Resulting Prompt (what the agent sees):
Common Issues:
For more help, visit the Asteroid Platform or check your execution logs there.