Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/bruno/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Agents API - Bruno Collection

Minimal Bruno API test collection for agent endpoints.

## Setup

1. Install Bruno: https://www.usebruno.com/
2. Open this collection in Bruno
3. Configure environment variables:
- `baseUrl`: Your API base URL (e.g., `http://localhost:3000`)

## Endpoints

### Public Endpoints
- `GET /api/agents` - List agents
- `GET /api/agents/:owner/:name` - Get agent details
- `GET /api/agents/:owner/:name/versions` - List agent versions

### Protected Endpoints (require authentication)
- `POST /api/agents` - Publish agent
- `PATCH /api/agents/:owner/:name` - Update agent metadata
- `DELETE /api/agents/:owner/:name` - Delete agent

## Usage

1. Start with public endpoints to verify API is working
2. Authenticate via your auth flow
3. Test protected endpoints with auth token
4. Update request bodies/params as needed for your test data
34 changes: 34 additions & 0 deletions docs/bruno/agents/delete-agent.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
meta {
name: DELETE /api/agents/:owner/:name
type: http
seq: 5
}

delete {
url: {{baseUrl}}/api/agents/testuser/my-agent
body: none
auth: inherit
}

tests {
test("should return 200 status", () => {
expect(res.getStatus()).to.equal(200);
});

test("should confirm deletion", () => {
expect(res.getBody()).to.have.property('success', true);
expect(res.getBody()).to.have.property('message');
});
}

docs {
Delete an agent and all its versions.
Requires authentication and ownership.

Path Parameters:
- owner: Username of the agent owner
- name: Agent name

Query Parameters (optional):
- version: Delete specific version instead of entire agent
}
37 changes: 37 additions & 0 deletions docs/bruno/agents/get-agent.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
meta {
name: GET /api/agents/:owner/:name
type: http
seq: 2
}

get {
url: {{baseUrl}}/api/agents/testuser/my-agent
body: none
auth: inherit
}

tests {
test("should return 200 status", () => {
expect(res.getStatus()).to.equal(200);
});

test("should return agent detail", () => {
expect(res.getBody()).to.have.property('success', true);
expect(res.getBody()).to.have.property('data');

const agent = res.getBody().data;
expect(agent).to.have.property('name');
expect(agent).to.have.property('owner');
expect(agent).to.have.property('latestVersion');
expect(agent).to.have.property('content');
expect(agent).to.have.property('stats');
});
}

docs {
Get agent details including latest version content.

Path Parameters:
- owner: Username of the agent owner
- name: Agent name (lowercase alphanumeric with hyphens)
}
43 changes: 43 additions & 0 deletions docs/bruno/agents/get-versions.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
meta {
name: GET /api/agents/:owner/:name/versions
type: http
seq: 4
}

get {
url: {{baseUrl}}/api/agents/testuser/my-agent/versions
body: none
auth: inherit
}

tests {
test("should return 200 status", () => {
expect(res.getStatus()).to.equal(200);
});

test("should return versions list", () => {
expect(res.getBody()).to.have.property('name');
expect(res.getBody()).to.have.property('owner');
expect(res.getBody()).to.have.property('versions');
expect(res.getBody().versions).to.be.an('array');
});

test("should have version details", () => {
const body = res.getBody();
if (body.versions.length > 0) {
const version = body.versions[0];
expect(version).to.have.property('version');
expect(version).to.have.property('publishedAt');
expect(version).to.have.property('downloads');
expect(version).to.have.property('isLatest');
}
});
}

docs {
List all versions of an agent.

Path Parameters:
- owner: Username of the agent owner
- name: Agent name
}
56 changes: 56 additions & 0 deletions docs/bruno/agents/list-agents.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
meta {
name: GET /api/agents
type: http
seq: 1
}

get {
url: {{baseUrl}}/api/agents?page=1&limit=20
body: none
auth: inherit
}

params:query {
page: 1
limit: 20
~visibility: public
~sort: downloads
}

tests {
test("should return 200 status", () => {
expect(res.getStatus()).to.equal(200);
});

test("should return agents list with pagination", () => {
expect(res.getBody()).to.have.property('agents');
expect(res.getBody().agents).to.be.an('array');
expect(res.getBody()).to.have.property('pagination');
expect(res.getBody().pagination).to.have.property('page');
expect(res.getBody().pagination).to.have.property('total');
});

test("should return agents in UI format", () => {
const body = res.getBody();
if (body.agents.length > 0) {
const agent = body.agents[0];
expect(agent).to.have.property('name');
expect(agent).to.have.property('owner');
expect(agent).to.have.property('latestVersion');
expect(agent).to.have.property('downloads');
expect(agent).to.have.property('visibility');
}
});
}

docs {
List agents with pagination and filtering.

Query Parameters:
- page: Page number (default: 1)
- limit: Items per page (1-100, default: 20)
- visibility: Filter by visibility (public/private/all)
- sort: Sort by (downloads/updated/created/name)
- owner: Filter by owner username
- tag: Filter by tag
}
55 changes: 55 additions & 0 deletions docs/bruno/agents/publish-agent.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
meta {
name: POST /api/agents
type: http
seq: 3
}

post {
url: {{baseUrl}}/api/agents
body: json
auth: inherit
}

body:json {
{
"name": "test-agent",
"description": "A test agent for demonstration",
"visibility": "public",
"version": "1.0.0",
"content": "export default function agent() { return 'Hello World'; }",
"tags": ["test", "demo"],
"changelog": "Initial release"
}
}

tests {
test("should return 201 status", () => {
expect(res.getStatus()).to.equal(201);
});

test("should return published agent info", () => {
expect(res.getBody()).to.have.property('success', true);
expect(res.getBody()).to.have.property('agent');

const agent = res.getBody().agent;
expect(agent).to.have.property('name');
expect(agent).to.have.property('owner');
expect(agent).to.have.property('version');
expect(agent).to.have.property('publishedAt');
});
}

docs {
Publish a new agent or new version of an existing agent.
Requires authentication.

Body:
- name: Agent name (3-50 chars, lowercase alphanumeric with hyphens)
- description: Description (10-500 chars, optional)
- visibility: "public" or "private"
- version: Semantic version (e.g., "1.0.0")
- content: Agent code (max 100KB)
- tags: Array of tags (max 10, optional)
- changelog: Version changelog (max 1000 chars, optional)
- readme: README content (max 50KB, optional)
}
6 changes: 6 additions & 0 deletions docs/bruno/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "1",
"name": "Agents API",
"type": "collection",
"ignore": ["node_modules", ".git"]
}
3 changes: 3 additions & 0 deletions docs/bruno/environments/development.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vars {
baseUrl: https://dev.agentage.io/
}
3 changes: 3 additions & 0 deletions docs/bruno/environments/localhost.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vars {
baseUrl: localhost:3000
}