@antipopp/agno-react 0.7.0 → 0.9.0

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.
package/README.md CHANGED
@@ -33,6 +33,12 @@ function App() {
33
33
  mode: 'agent',
34
34
  agentId: 'your-agent-id',
35
35
  userId: 'user-123', // Optional: Link sessions to a user
36
+ headers: { // Optional: Global headers for all requests
37
+ 'X-API-Version': 'v2'
38
+ },
39
+ params: { // Optional: Global query params for all requests
40
+ locale: 'en-US'
41
+ }
36
42
  }}
37
43
  >
38
44
  <YourComponents />
@@ -134,6 +140,17 @@ await sendMessage(formData);
134
140
  await sendMessage('Hello!', {
135
141
  headers: { 'X-Custom': 'value' }
136
142
  });
143
+
144
+ // Send with query parameters
145
+ await sendMessage('Hello!', {
146
+ params: { temperature: '0.7', max_tokens: '500' }
147
+ });
148
+
149
+ // Send with both headers and params
150
+ await sendMessage('Hello!', {
151
+ headers: { 'X-Request-ID': '12345' },
152
+ params: { debug: 'true' }
153
+ });
137
154
  ```
138
155
 
139
156
  #### `clearMessages()`
@@ -164,14 +181,20 @@ function SessionList() {
164
181
  const { sessions, loadSession, fetchSessions } = useAgnoSession();
165
182
 
166
183
  useEffect(() => {
167
- fetchSessions();
184
+ // Fetch sessions with optional query params
185
+ fetchSessions({ params: { limit: '50', status: 'active' } });
168
186
  }, [fetchSessions]);
169
187
 
188
+ const handleLoadSession = (sessionId: string) => {
189
+ // Load session with optional params
190
+ loadSession(sessionId, { params: { include_metadata: 'true' } });
191
+ };
192
+
170
193
  return (
171
194
  <ul>
172
195
  {sessions.map((session) => (
173
196
  <li key={session.session_id}>
174
- <button onClick={() => loadSession(session.session_id)}>
197
+ <button onClick={() => handleLoadSession(session.session_id)}>
175
198
  {session.session_name}
176
199
  </button>
177
200
  </li>
@@ -201,13 +224,19 @@ const {
201
224
 
202
225
  ```tsx
203
226
  function InitComponent() {
204
- const { initialize, updateConfig, isInitializing } = useAgnoActions();
227
+ const { initialize, fetchAgents, updateConfig, isInitializing } = useAgnoActions();
205
228
  const { state } = useAgnoChat();
206
229
 
207
230
  useEffect(() => {
208
- initialize();
231
+ // Initialize with optional params
232
+ initialize({ params: { filter: 'active' } });
209
233
  }, [initialize]);
210
234
 
235
+ const loadMoreAgents = () => {
236
+ // Fetch agents with custom params
237
+ fetchAgents({ params: { page: '2', limit: '20' } });
238
+ };
239
+
211
240
  const switchAgent = (agentId: string) => {
212
241
  updateConfig({ agentId, mode: 'agent' });
213
242
  };
@@ -222,6 +251,7 @@ function InitComponent() {
222
251
  {agent.name}
223
252
  </button>
224
253
  ))}
254
+ <button onClick={loadMoreAgents}>Load More</button>
225
255
  </div>
226
256
  );
227
257
  }
package/dist/index.d.mts CHANGED
@@ -71,7 +71,10 @@ declare function useAgnoToolExecution(handlers?: Record<string, ToolHandler>, au
71
71
  /** Execute specific tools and return results without continuing */
72
72
  executeTools: (tools: ToolCall[]) => Promise<ToolCall[]>;
73
73
  /** Continue the run with manually provided tool results */
74
- continueWithResults: (tools: ToolCall[]) => Promise<void>;
74
+ continueWithResults: (tools: ToolCall[], options?: {
75
+ headers?: Record<string, string>;
76
+ params?: Record<string, string>;
77
+ }) => Promise<void>;
75
78
  /** Error from tool execution, if any */
76
79
  executionError: string | undefined;
77
80
  };
@@ -374,9 +377,11 @@ declare function useAgnoChat(): {
374
377
  messages: ChatMessage[];
375
378
  sendMessage: (message: string | FormData, options?: {
376
379
  headers?: Record<string, string>;
380
+ params?: Record<string, string>;
377
381
  }) => Promise<void>;
378
382
  clearMessages: () => void;
379
383
  isStreaming: boolean;
384
+ isRefreshing: boolean;
380
385
  isPaused: boolean;
381
386
  error: string | undefined;
382
387
  state: ClientState;
@@ -388,8 +393,12 @@ declare function useAgnoChat(): {
388
393
  declare function useAgnoSession(): {
389
394
  sessions: SessionEntry[];
390
395
  currentSessionId: string | undefined;
391
- loadSession: (sessionId: string) => Promise<ChatMessage[]>;
392
- fetchSessions: () => Promise<SessionEntry[]>;
396
+ loadSession: (sessionId: string, options?: {
397
+ params?: Record<string, string>;
398
+ }) => Promise<ChatMessage[]>;
399
+ fetchSessions: (options?: {
400
+ params?: Record<string, string>;
401
+ }) => Promise<SessionEntry[]>;
393
402
  isLoading: boolean;
394
403
  error: string | undefined;
395
404
  };
@@ -398,13 +407,21 @@ declare function useAgnoSession(): {
398
407
  * Hook for common actions like initialization, fetching agents/teams
399
408
  */
400
409
  declare function useAgnoActions(): {
401
- initialize: () => Promise<{
410
+ initialize: (options?: {
411
+ params?: Record<string, string>;
412
+ }) => Promise<{
402
413
  agents: AgentDetails[];
403
414
  teams: TeamDetails[];
404
415
  }>;
405
- checkStatus: () => Promise<boolean>;
406
- fetchAgents: () => Promise<AgentDetails[]>;
407
- fetchTeams: () => Promise<TeamDetails[]>;
416
+ checkStatus: (options?: {
417
+ params?: Record<string, string>;
418
+ }) => Promise<boolean>;
419
+ fetchAgents: (options?: {
420
+ params?: Record<string, string>;
421
+ }) => Promise<AgentDetails[]>;
422
+ fetchTeams: (options?: {
423
+ params?: Record<string, string>;
424
+ }) => Promise<TeamDetails[]>;
408
425
  updateConfig: (updates: Partial<Parameters<(updates: Partial<_antipopp_agno_types.AgnoClientConfig>) => void>[0]>) => void;
409
426
  isInitializing: boolean;
410
427
  error: string | undefined;
package/dist/index.d.ts CHANGED
@@ -71,7 +71,10 @@ declare function useAgnoToolExecution(handlers?: Record<string, ToolHandler>, au
71
71
  /** Execute specific tools and return results without continuing */
72
72
  executeTools: (tools: ToolCall[]) => Promise<ToolCall[]>;
73
73
  /** Continue the run with manually provided tool results */
74
- continueWithResults: (tools: ToolCall[]) => Promise<void>;
74
+ continueWithResults: (tools: ToolCall[], options?: {
75
+ headers?: Record<string, string>;
76
+ params?: Record<string, string>;
77
+ }) => Promise<void>;
75
78
  /** Error from tool execution, if any */
76
79
  executionError: string | undefined;
77
80
  };
@@ -374,9 +377,11 @@ declare function useAgnoChat(): {
374
377
  messages: ChatMessage[];
375
378
  sendMessage: (message: string | FormData, options?: {
376
379
  headers?: Record<string, string>;
380
+ params?: Record<string, string>;
377
381
  }) => Promise<void>;
378
382
  clearMessages: () => void;
379
383
  isStreaming: boolean;
384
+ isRefreshing: boolean;
380
385
  isPaused: boolean;
381
386
  error: string | undefined;
382
387
  state: ClientState;
@@ -388,8 +393,12 @@ declare function useAgnoChat(): {
388
393
  declare function useAgnoSession(): {
389
394
  sessions: SessionEntry[];
390
395
  currentSessionId: string | undefined;
391
- loadSession: (sessionId: string) => Promise<ChatMessage[]>;
392
- fetchSessions: () => Promise<SessionEntry[]>;
396
+ loadSession: (sessionId: string, options?: {
397
+ params?: Record<string, string>;
398
+ }) => Promise<ChatMessage[]>;
399
+ fetchSessions: (options?: {
400
+ params?: Record<string, string>;
401
+ }) => Promise<SessionEntry[]>;
393
402
  isLoading: boolean;
394
403
  error: string | undefined;
395
404
  };
@@ -398,13 +407,21 @@ declare function useAgnoSession(): {
398
407
  * Hook for common actions like initialization, fetching agents/teams
399
408
  */
400
409
  declare function useAgnoActions(): {
401
- initialize: () => Promise<{
410
+ initialize: (options?: {
411
+ params?: Record<string, string>;
412
+ }) => Promise<{
402
413
  agents: AgentDetails[];
403
414
  teams: TeamDetails[];
404
415
  }>;
405
- checkStatus: () => Promise<boolean>;
406
- fetchAgents: () => Promise<AgentDetails[]>;
407
- fetchTeams: () => Promise<TeamDetails[]>;
416
+ checkStatus: (options?: {
417
+ params?: Record<string, string>;
418
+ }) => Promise<boolean>;
419
+ fetchAgents: (options?: {
420
+ params?: Record<string, string>;
421
+ }) => Promise<AgentDetails[]>;
422
+ fetchTeams: (options?: {
423
+ params?: Record<string, string>;
424
+ }) => Promise<TeamDetails[]>;
408
425
  updateConfig: (updates: Partial<Parameters<(updates: Partial<_antipopp_agno_types.AgnoClientConfig>) => void>[0]>) => void;
409
426
  isInitializing: boolean;
410
427
  error: string | undefined;
package/dist/index.js CHANGED
@@ -399,13 +399,13 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
399
399
  [mergedHandlers]
400
400
  );
401
401
  const continueWithResults = (0, import_react3.useCallback)(
402
- async (tools) => {
402
+ async (tools, options) => {
403
403
  if (!isPaused) {
404
404
  throw new Error("No paused run to continue");
405
405
  }
406
406
  setIsExecuting(true);
407
407
  try {
408
- await client.continueRun(tools);
408
+ await client.continueRun(tools, options);
409
409
  } catch (error) {
410
410
  setIsExecuting(false);
411
411
  throw error;
@@ -788,6 +788,9 @@ function useAgnoChat() {
788
788
  const handleMessageComplete = (updatedMessages) => {
789
789
  setMessages(updatedMessages);
790
790
  };
791
+ const handleMessageRefreshed = (updatedMessages) => {
792
+ setMessages(updatedMessages);
793
+ };
791
794
  const handleMessageError = (errorMessage) => {
792
795
  setError(errorMessage);
793
796
  };
@@ -804,6 +807,7 @@ function useAgnoChat() {
804
807
  };
805
808
  client.on("message:update", handleMessageUpdate);
806
809
  client.on("message:complete", handleMessageComplete);
810
+ client.on("message:refreshed", handleMessageRefreshed);
807
811
  client.on("message:error", handleMessageError);
808
812
  client.on("state:change", handleStateChange);
809
813
  client.on("ui:render", handleUIRender);
@@ -812,6 +816,7 @@ function useAgnoChat() {
812
816
  return () => {
813
817
  client.off("message:update", handleMessageUpdate);
814
818
  client.off("message:complete", handleMessageComplete);
819
+ client.off("message:refreshed", handleMessageRefreshed);
815
820
  client.off("message:error", handleMessageError);
816
821
  client.off("state:change", handleStateChange);
817
822
  client.off("ui:render", handleUIRender);
@@ -840,6 +845,7 @@ function useAgnoChat() {
840
845
  sendMessage,
841
846
  clearMessages,
842
847
  isStreaming: state.isStreaming,
848
+ isRefreshing: state.isRefreshing,
843
849
  isPaused: state.isPaused,
844
850
  error,
845
851
  state
@@ -881,11 +887,11 @@ function useAgnoSession() {
881
887
  };
882
888
  }, [client]);
883
889
  const loadSession = (0, import_react6.useCallback)(
884
- async (sessionId) => {
890
+ async (sessionId, options) => {
885
891
  setIsLoading(true);
886
892
  setError(void 0);
887
893
  try {
888
- const messages = await client.loadSession(sessionId);
894
+ const messages = await client.loadSession(sessionId, options);
889
895
  setCurrentSessionId(sessionId);
890
896
  return messages;
891
897
  } catch (err) {
@@ -898,11 +904,11 @@ function useAgnoSession() {
898
904
  },
899
905
  [client]
900
906
  );
901
- const fetchSessions = (0, import_react6.useCallback)(async () => {
907
+ const fetchSessions = (0, import_react6.useCallback)(async (options) => {
902
908
  setIsLoading(true);
903
909
  setError(void 0);
904
910
  try {
905
- const fetchedSessions = await client.fetchSessions();
911
+ const fetchedSessions = await client.fetchSessions(options);
906
912
  setSessions(fetchedSessions);
907
913
  return fetchedSessions;
908
914
  } catch (err) {
@@ -929,11 +935,11 @@ function useAgnoActions() {
929
935
  const client = useAgnoClient();
930
936
  const [isInitializing, setIsInitializing] = (0, import_react7.useState)(false);
931
937
  const [error, setError] = (0, import_react7.useState)();
932
- const initialize = (0, import_react7.useCallback)(async () => {
938
+ const initialize = (0, import_react7.useCallback)(async (options) => {
933
939
  setIsInitializing(true);
934
940
  setError(void 0);
935
941
  try {
936
- const result = await client.initialize();
942
+ const result = await client.initialize(options);
937
943
  return result;
938
944
  } catch (err) {
939
945
  const errorMessage = err instanceof Error ? err.message : String(err);
@@ -943,30 +949,30 @@ function useAgnoActions() {
943
949
  setIsInitializing(false);
944
950
  }
945
951
  }, [client]);
946
- const checkStatus = (0, import_react7.useCallback)(async () => {
952
+ const checkStatus = (0, import_react7.useCallback)(async (options) => {
947
953
  setError(void 0);
948
954
  try {
949
- return await client.checkStatus();
955
+ return await client.checkStatus(options);
950
956
  } catch (err) {
951
957
  const errorMessage = err instanceof Error ? err.message : String(err);
952
958
  setError(errorMessage);
953
959
  return false;
954
960
  }
955
961
  }, [client]);
956
- const fetchAgents = (0, import_react7.useCallback)(async () => {
962
+ const fetchAgents = (0, import_react7.useCallback)(async (options) => {
957
963
  setError(void 0);
958
964
  try {
959
- return await client.fetchAgents();
965
+ return await client.fetchAgents(options);
960
966
  } catch (err) {
961
967
  const errorMessage = err instanceof Error ? err.message : String(err);
962
968
  setError(errorMessage);
963
969
  throw err;
964
970
  }
965
971
  }, [client]);
966
- const fetchTeams = (0, import_react7.useCallback)(async () => {
972
+ const fetchTeams = (0, import_react7.useCallback)(async (options) => {
967
973
  setError(void 0);
968
974
  try {
969
- return await client.fetchTeams();
975
+ return await client.fetchTeams(options);
970
976
  } catch (err) {
971
977
  const errorMessage = err instanceof Error ? err.message : String(err);
972
978
  setError(errorMessage);
package/dist/index.mjs CHANGED
@@ -334,13 +334,13 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true) {
334
334
  [mergedHandlers]
335
335
  );
336
336
  const continueWithResults = useCallback2(
337
- async (tools) => {
337
+ async (tools, options) => {
338
338
  if (!isPaused) {
339
339
  throw new Error("No paused run to continue");
340
340
  }
341
341
  setIsExecuting(true);
342
342
  try {
343
- await client.continueRun(tools);
343
+ await client.continueRun(tools, options);
344
344
  } catch (error) {
345
345
  setIsExecuting(false);
346
346
  throw error;
@@ -723,6 +723,9 @@ function useAgnoChat() {
723
723
  const handleMessageComplete = (updatedMessages) => {
724
724
  setMessages(updatedMessages);
725
725
  };
726
+ const handleMessageRefreshed = (updatedMessages) => {
727
+ setMessages(updatedMessages);
728
+ };
726
729
  const handleMessageError = (errorMessage) => {
727
730
  setError(errorMessage);
728
731
  };
@@ -739,6 +742,7 @@ function useAgnoChat() {
739
742
  };
740
743
  client.on("message:update", handleMessageUpdate);
741
744
  client.on("message:complete", handleMessageComplete);
745
+ client.on("message:refreshed", handleMessageRefreshed);
742
746
  client.on("message:error", handleMessageError);
743
747
  client.on("state:change", handleStateChange);
744
748
  client.on("ui:render", handleUIRender);
@@ -747,6 +751,7 @@ function useAgnoChat() {
747
751
  return () => {
748
752
  client.off("message:update", handleMessageUpdate);
749
753
  client.off("message:complete", handleMessageComplete);
754
+ client.off("message:refreshed", handleMessageRefreshed);
750
755
  client.off("message:error", handleMessageError);
751
756
  client.off("state:change", handleStateChange);
752
757
  client.off("ui:render", handleUIRender);
@@ -775,6 +780,7 @@ function useAgnoChat() {
775
780
  sendMessage,
776
781
  clearMessages,
777
782
  isStreaming: state.isStreaming,
783
+ isRefreshing: state.isRefreshing,
778
784
  isPaused: state.isPaused,
779
785
  error,
780
786
  state
@@ -816,11 +822,11 @@ function useAgnoSession() {
816
822
  };
817
823
  }, [client]);
818
824
  const loadSession = useCallback4(
819
- async (sessionId) => {
825
+ async (sessionId, options) => {
820
826
  setIsLoading(true);
821
827
  setError(void 0);
822
828
  try {
823
- const messages = await client.loadSession(sessionId);
829
+ const messages = await client.loadSession(sessionId, options);
824
830
  setCurrentSessionId(sessionId);
825
831
  return messages;
826
832
  } catch (err) {
@@ -833,11 +839,11 @@ function useAgnoSession() {
833
839
  },
834
840
  [client]
835
841
  );
836
- const fetchSessions = useCallback4(async () => {
842
+ const fetchSessions = useCallback4(async (options) => {
837
843
  setIsLoading(true);
838
844
  setError(void 0);
839
845
  try {
840
- const fetchedSessions = await client.fetchSessions();
846
+ const fetchedSessions = await client.fetchSessions(options);
841
847
  setSessions(fetchedSessions);
842
848
  return fetchedSessions;
843
849
  } catch (err) {
@@ -864,11 +870,11 @@ function useAgnoActions() {
864
870
  const client = useAgnoClient();
865
871
  const [isInitializing, setIsInitializing] = useState5(false);
866
872
  const [error, setError] = useState5();
867
- const initialize = useCallback5(async () => {
873
+ const initialize = useCallback5(async (options) => {
868
874
  setIsInitializing(true);
869
875
  setError(void 0);
870
876
  try {
871
- const result = await client.initialize();
877
+ const result = await client.initialize(options);
872
878
  return result;
873
879
  } catch (err) {
874
880
  const errorMessage = err instanceof Error ? err.message : String(err);
@@ -878,30 +884,30 @@ function useAgnoActions() {
878
884
  setIsInitializing(false);
879
885
  }
880
886
  }, [client]);
881
- const checkStatus = useCallback5(async () => {
887
+ const checkStatus = useCallback5(async (options) => {
882
888
  setError(void 0);
883
889
  try {
884
- return await client.checkStatus();
890
+ return await client.checkStatus(options);
885
891
  } catch (err) {
886
892
  const errorMessage = err instanceof Error ? err.message : String(err);
887
893
  setError(errorMessage);
888
894
  return false;
889
895
  }
890
896
  }, [client]);
891
- const fetchAgents = useCallback5(async () => {
897
+ const fetchAgents = useCallback5(async (options) => {
892
898
  setError(void 0);
893
899
  try {
894
- return await client.fetchAgents();
900
+ return await client.fetchAgents(options);
895
901
  } catch (err) {
896
902
  const errorMessage = err instanceof Error ? err.message : String(err);
897
903
  setError(errorMessage);
898
904
  throw err;
899
905
  }
900
906
  }, [client]);
901
- const fetchTeams = useCallback5(async () => {
907
+ const fetchTeams = useCallback5(async (options) => {
902
908
  setError(void 0);
903
909
  try {
904
- return await client.fetchTeams();
910
+ return await client.fetchTeams(options);
905
911
  } catch (err) {
906
912
  const errorMessage = err instanceof Error ? err.message : String(err);
907
913
  setError(errorMessage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antipopp/agno-react",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "React hooks for Agno client with frontend tool execution (HITL) support",
5
5
  "author": "antipopp",
6
6
  "license": "MIT",
@@ -34,8 +34,8 @@
34
34
  "README.md"
35
35
  ],
36
36
  "dependencies": {
37
- "@antipopp/agno-client": "0.7.0",
38
- "@antipopp/agno-types": "0.7.0"
37
+ "@antipopp/agno-client": "0.9.0",
38
+ "@antipopp/agno-types": "0.9.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^18.0.0 || ^19.0.0"