@circuitorg/agent-sdk 1.3.7 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +15 -13
  2. package/index.d.ts +987 -652
  3. package/index.js +1 -1
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Circuit Agent SDK - TypeScript
2
2
 
3
+ > NOTE: Please refer to our all in one [Circuit Documentation](https://app.gitbook.com/o/yfLOFAxdeW0k9oNMRvxo/s/JCFI1CxS0CCJGcFs2OVc/agent-developers/sdk-reference):
4
+ > We will be reducing this down to instructions for sdk developers and will refer agent developers to the public gitbooks.
5
+
6
+
3
7
  > **Clean, unified, type-safe TypeScript SDK for building cross-chain agents on Circuit**
4
8
 
5
9
  A simplified TypeScript SDK for building automated agents to deploy on Circuit. Agents receive a single `AgentContext` object containing everything they need - request data, SDK methods, and unified logging. No boilerplate, no return values to manage, just write your logic.
@@ -16,7 +20,7 @@ A simplified TypeScript SDK for building automated agents to deploy on Circuit.
16
20
  - [Required Asset setup](#required-asset-setup)
17
21
  - [🎯 Core Concepts](#-core-concepts)
18
22
  - [The AgentContext Object](#the-agentcontext-object)
19
- - [Run/Stop Function Requirements](#runstop-function-requirements)
23
+ - [Run/Unwind Function Requirements](#rununwind-function-requirements)
20
24
  - [📝 Unified Logging with agent.log()](#-unified-logging-with-agentlog)
21
25
  - [💾 Session Memory Storage](#-session-memory-storage)
22
26
  - [🌉 Cross-Chain Swaps with Swidge](#-cross-chain-swaps-with-swidge)
@@ -113,16 +117,15 @@ async function run(agent: AgentContext): Promise<void> {
113
117
  // Circuit will provide updated positions on the next run
114
118
  }
115
119
 
116
- async function stop(agent: AgentContext): Promise<void> {
117
- /**Cleanup when agent is stopped.*/
118
- await agent.log("Cleaning up resources");
119
- await agent.memory.delete("temp_data");
120
+ async function unwind(agent: AgentContext, positions: CurrentPosition[]): Promise<void> {
121
+ /**Allocation adjustment / cleanup when agent is asked to unwind positions.*/
122
+ await agent.log(`Unwinding ${positions.length} positions`);
120
123
  }
121
124
 
122
- // Boilerplate - This should never change unless you want to change the names of your run and stop functions
125
+ // Boilerplate - This should never change unless you want to change the names of your run and unwind functions
123
126
  const agent = new Agent({
124
127
  runFunction: run,
125
- stopFunction: stop
128
+ unwindFunction: unwind
126
129
  });
127
130
 
128
131
  export default agent.getExport();
@@ -148,7 +151,7 @@ Every agent function receives a single `AgentContext` object that contains:
148
151
  - `agent.signMessage()` - Sign messages on EVM
149
152
  - `agent.transactions()` - Get transaction history with asset changes
150
153
 
151
- ### Run/Stop Function Requirements
154
+ ### Run/Unwind Function Requirements
152
155
 
153
156
  1. **Signature**: `async function myFunction(agent: AgentContext): Promise<void>`
154
157
  2. **Return**: Always return `void` (or no return statement)
@@ -320,7 +323,7 @@ async function run(agent: AgentContext): Promise<void> {
320
323
  ### Redeem Positions
321
324
 
322
325
  ```typescript
323
- async function stop(agent: AgentContext): Promise<void> {
326
+ async function unwind(agent: AgentContext): Promise<void> {
324
327
  /**Redeem all settled positions.*/
325
328
  const redemption = await agent.platforms.polymarket.redeemPositions();
326
329
 
@@ -583,9 +586,8 @@ async function run(agent: AgentContext): Promise<void> {
583
586
  // Your agent logic here
584
587
  }
585
588
 
586
- async function stop(agent: AgentContext): Promise<void> {
587
- await agent.log("Cleaning up...");
588
- // Optional cleanup logic
589
+ async function unwind(agent: AgentContext, positions: CurrentPosition[]): Promise<void> {
590
+ await agent.log(`Cleaning up (unwind requested for ${positions.length} positions)...`);
589
591
  }
590
592
 
591
593
  // ============================================================================
@@ -593,7 +595,7 @@ async function stop(agent: AgentContext): Promise<void> {
593
595
  // ============================================================================
594
596
  const agent = new Agent({
595
597
  runFunction: run,
596
- stopFunction: stop
598
+ unwindFunction: unwind
597
599
  });
598
600
 
599
601
  export default agent.getExport();