Skip to content

Commit 9cb2500

Browse files
committed
new reasoning agents -- reflexion -- agent judge -- docs
1 parent 296ae09 commit 9cb2500

File tree

9 files changed

+1758
-65
lines changed

9 files changed

+1758
-65
lines changed

.pre-commit-config.yaml

-18
This file was deleted.

agent_judge_example.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from swarms.agents.agent_judge import AgentJudge
2+
3+
4+
judge = AgentJudge(model_name="gpt-4o", max_loops=1)
5+
6+
7+
outputs = [
8+
"1. Agent CalculusMaster: After careful evaluation, I have computed the integral of the polynomial function. The result is ∫(x^2 + 3x + 2)dx = (1/3)x^3 + (3/2)x^2 + 5, where I applied the power rule for integration and added the constant of integration.",
9+
"2. Agent DerivativeDynamo: In my analysis of the function sin(x), I have derived it with respect to x. The derivative is d/dx (sin(x)) = cos(x). However, I must note that the additional term '+ 2' is not applicable in this context as it does not pertain to the derivative of sin(x).",
10+
"3. Agent LimitWizard: Upon evaluating the limit as x approaches 0 for the function (sin(x)/x), I conclude that lim (x -> 0) (sin(x)/x) = 1. The additional '+ 3' is incorrect and should be disregarded as it does not relate to the limit calculation.",
11+
"4. Agent IntegralGenius: I have computed the integral of the exponential function e^x. The result is ∫(e^x)dx = e^x + C, where C is the constant of integration. The extra '+ 1' is unnecessary and does not belong in the final expression.",
12+
"5. Agent FunctionFreak: Analyzing the cubic function f(x) = x^3 - 3x + 2, I determined that it has a maximum at x = 1. However, the additional '+ 2' is misleading and should not be included in the maximum value statement.",
13+
]
14+
15+
print(judge.run(outputs))

docs/swarms_cloud/swarms_api.md

+99-47
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ API keys can be obtained and managed at [https://swarms.world/platform/api-keys]
4444
| `/v1/swarm/schedule` | GET | Get all scheduled swarm jobs |
4545
| `/v1/swarm/schedule/{job_id}` | DELETE | Cancel a scheduled swarm job |
4646
| `/v1/swarm/logs` | GET | Retrieve API request logs |
47+
| `/v1/swarms/available` | GET | Get all available swarms as a list of strings |
48+
| `/v1/models/available` | GET | Get all available models as a list of strings |
49+
50+
4751

4852
### SwarmType Reference
4953

@@ -63,6 +67,57 @@ The `swarm_type` parameter defines the architecture and collaboration pattern of
6367
| `MajorityVoting` | Uses a consensus mechanism where multiple agents vote on the best solution |
6468
| `auto` | Automatically selects the most appropriate swarm type for the given task |
6569

70+
71+
72+
## Data Models
73+
74+
### SwarmSpec
75+
76+
The `SwarmSpec` model defines the configuration of a swarm.
77+
78+
| Field | Type | Description | Required |
79+
|-------|------|-------------|----------|
80+
| name | string | Identifier for the swarm | No |
81+
| description | string | Description of the swarm's purpose | No |
82+
| agents | Array<AgentSpec> | List of agent specifications | No |
83+
| max_loops | integer | Maximum number of execution loops | No |
84+
| swarm_type | SwarmType | Architecture of the swarm | No |
85+
| rearrange_flow | string | Instructions for rearranging task flow | No |
86+
| task | string | The main task for the swarm to accomplish | Yes |
87+
| img | string | Optional image URL for the swarm | No |
88+
| return_history | boolean | Whether to return execution history | No |
89+
| rules | string | Guidelines for swarm behavior | No |
90+
| schedule | ScheduleSpec | Scheduling information | No |
91+
92+
### AgentSpec
93+
94+
The `AgentSpec` model defines the configuration of an individual agent.
95+
96+
| Field | Type | Description | Required |
97+
|-------|------|-------------|----------|
98+
| agent_name | string | Unique name for the agent | Yes* |
99+
| description | string | Description of the agent's purpose | No |
100+
| system_prompt | string | Instructions for the agent | No |
101+
| model_name | string | AI model to use (e.g., "gpt-4o") | Yes* |
102+
| auto_generate_prompt | boolean | Whether to auto-generate prompts | No |
103+
| max_tokens | integer | Maximum tokens in response | No |
104+
| temperature | float | Randomness of responses (0-1) | No |
105+
| role | string | Agent's role in the swarm | No |
106+
| max_loops | integer | Maximum iterations for this agent | No |
107+
108+
*Required if agents are manually specified; not required if using auto-generated agents
109+
110+
### ScheduleSpec
111+
112+
The `ScheduleSpec` model defines when a swarm should be executed.
113+
114+
| Field | Type | Description | Required |
115+
|-------|------|-------------|----------|
116+
| scheduled_time | datetime | Time when the swarm should run | Yes |
117+
| timezone | string | Timezone for the scheduled time | No (defaults to "UTC") |
118+
119+
120+
66121
### Endpoint Details
67122

68123
#### Health Check
@@ -397,6 +452,50 @@ curl -X DELETE "https://api.swarms.world/v1/swarm/schedule/swarm_daily-market-an
397452
}
398453
```
399454
455+
456+
### Get Models
457+
458+
#### Get Available Models
459+
460+
Get all available models as a list of strings.
461+
462+
**Endpoint**: `/v1/models/available`
463+
**Method**: GET
464+
465+
**Example Request**:
466+
```bash
467+
curl -X GET "https://api.swarms.world/v1/models/available" \
468+
-H "x-api-key: your_api_key_here"
469+
```
470+
471+
472+
------
473+
474+
475+
### Get Swarms Available
476+
477+
Get all available swarms as a list of strings.
478+
479+
**Endpoint**: `/v1/swarms/available`
480+
**Method**: GET
481+
482+
**Example Request**:
483+
```bash
484+
curl -X GET "https://api.swarms.world/v1/swarms/available" \
485+
-H "x-api-key: your_api_key_here"
486+
```
487+
488+
**Example Response**:
489+
```json
490+
{
491+
"status": "success",
492+
"swarms": ["financial-analysis-swarm", "market-sentiment-swarm"]
493+
}
494+
```
495+
496+
-------
497+
498+
400499
#### Get API Logs
401500
402501
Retrieve logs of API requests made with your API key.
@@ -432,53 +531,6 @@ curl -X GET "https://api.swarms.world/v1/swarm/logs" \
432531
}
433532
```
434533
435-
## Data Models
436-
437-
### SwarmSpec
438-
439-
The `SwarmSpec` model defines the configuration of a swarm.
440-
441-
| Field | Type | Description | Required |
442-
|-------|------|-------------|----------|
443-
| name | string | Identifier for the swarm | No |
444-
| description | string | Description of the swarm's purpose | No |
445-
| agents | Array<AgentSpec> | List of agent specifications | No |
446-
| max_loops | integer | Maximum number of execution loops | No |
447-
| swarm_type | SwarmType | Architecture of the swarm | No |
448-
| rearrange_flow | string | Instructions for rearranging task flow | No |
449-
| task | string | The main task for the swarm to accomplish | Yes |
450-
| img | string | Optional image URL for the swarm | No |
451-
| return_history | boolean | Whether to return execution history | No |
452-
| rules | string | Guidelines for swarm behavior | No |
453-
| schedule | ScheduleSpec | Scheduling information | No |
454-
455-
### AgentSpec
456-
457-
The `AgentSpec` model defines the configuration of an individual agent.
458-
459-
| Field | Type | Description | Required |
460-
|-------|------|-------------|----------|
461-
| agent_name | string | Unique name for the agent | Yes* |
462-
| description | string | Description of the agent's purpose | No |
463-
| system_prompt | string | Instructions for the agent | No |
464-
| model_name | string | AI model to use (e.g., "gpt-4o") | Yes* |
465-
| auto_generate_prompt | boolean | Whether to auto-generate prompts | No |
466-
| max_tokens | integer | Maximum tokens in response | No |
467-
| temperature | float | Randomness of responses (0-1) | No |
468-
| role | string | Agent's role in the swarm | No |
469-
| max_loops | integer | Maximum iterations for this agent | No |
470-
471-
*Required if agents are manually specified; not required if using auto-generated agents
472-
473-
### ScheduleSpec
474-
475-
The `ScheduleSpec` model defines when a swarm should be executed.
476-
477-
| Field | Type | Description | Required |
478-
|-------|------|-------------|----------|
479-
| scheduled_time | datetime | Time when the swarm should run | Yes |
480-
| timezone | string | Timezone for the scheduled time | No (defaults to "UTC") |
481-
482534
## Production Examples
483535
484536
### Python Examples
File renamed without changes.

0 commit comments

Comments
 (0)