agent-skill-compiler 0.1.0__tar.gz
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.
- agent_skill_compiler-0.1.0/.dockerignore +10 -0
- agent_skill_compiler-0.1.0/.env.example +5 -0
- agent_skill_compiler-0.1.0/.gitignore +7 -0
- agent_skill_compiler-0.1.0/Dockerfile +19 -0
- agent_skill_compiler-0.1.0/PKG-INFO +220 -0
- agent_skill_compiler-0.1.0/README.md +202 -0
- agent_skill_compiler-0.1.0/docker-compose.yml +11 -0
- agent_skill_compiler-0.1.0/docs/BACKEND_INTEGRATION.md +134 -0
- agent_skill_compiler-0.1.0/pyproject.toml +31 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/__init__.py +5 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/analysis/__init__.py +6 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/analysis/pipeline.py +297 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/api/__init__.py +5 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/api/app.py +258 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/auth.py +40 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/cli/__init__.py +1 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/cli/app.py +115 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/config/__init__.py +5 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/config/settings.py +38 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/models/__init__.py +34 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/models/api.py +65 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/models/domain.py +141 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/reporting/__init__.py +5 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/reporting/renderers.py +116 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/sdk/__init__.py +5 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/sdk/client.py +96 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/services/__init__.py +5 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/services/compiler.py +194 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/storage/__init__.py +5 -0
- agent_skill_compiler-0.1.0/src/agent_skill_compiler/storage/sqlite.py +448 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
FROM python:3.13-slim
|
|
2
|
+
|
|
3
|
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
4
|
+
PYTHONUNBUFFERED=1
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
COPY pyproject.toml README.md ./
|
|
9
|
+
COPY src ./src
|
|
10
|
+
|
|
11
|
+
RUN pip install --no-cache-dir .
|
|
12
|
+
|
|
13
|
+
RUN mkdir -p /app/.data /app/reports
|
|
14
|
+
|
|
15
|
+
EXPOSE 8000
|
|
16
|
+
|
|
17
|
+
VOLUME ["/app/.data", "/app/reports"]
|
|
18
|
+
|
|
19
|
+
CMD ["agent-skill-compiler", "serve", "--host", "0.0.0.0", "--port", "8000"]
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-skill-compiler
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local-first toolkit for mining repeated multi-agent execution patterns into candidate skills.
|
|
5
|
+
Author: Open Source Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: agents,ai,analysis,skills,tooling,tracing
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Requires-Dist: fastapi>=0.115.0
|
|
10
|
+
Requires-Dist: httpx>=0.28.1
|
|
11
|
+
Requires-Dist: jinja2>=3.1.6
|
|
12
|
+
Requires-Dist: pydantic-settings>=2.13.1
|
|
13
|
+
Requires-Dist: pydantic>=2.11.0
|
|
14
|
+
Requires-Dist: rich>=14.0.0
|
|
15
|
+
Requires-Dist: typer>=0.15.3
|
|
16
|
+
Requires-Dist: uvicorn>=0.34.0
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# Agent Skill Compiler
|
|
20
|
+
|
|
21
|
+
Agent Skill Compiler is an API-first backend and Python SDK for collecting agent traces, storing project-scoped runs, and analyzing repeated execution patterns into candidate skills.
|
|
22
|
+
|
|
23
|
+
This repository intentionally ships no frontend. The supported deployment model is:
|
|
24
|
+
|
|
25
|
+
1. deploy this package as your tracing and analysis API
|
|
26
|
+
2. instrument your backend agents with the Python SDK using `base_url`, `public_key`, and `secret_key`
|
|
27
|
+
3. build your frontend in a separate repo against this API using `base_url` plus the project `public_key`
|
|
28
|
+
|
|
29
|
+
## Auth Model
|
|
30
|
+
|
|
31
|
+
- trusted backend writes: `public_key` + `secret_key`
|
|
32
|
+
- frontend reads: `public_key`
|
|
33
|
+
- admin/project provisioning: optional `ASC_ADMIN_TOKEN`
|
|
34
|
+
|
|
35
|
+
Never expose the `secret_key` in browser code.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install agent-skill-compiler
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For local development:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python3.11 -m venv .venv
|
|
47
|
+
source .venv/bin/activate
|
|
48
|
+
pip install -e .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Run The API
|
|
52
|
+
|
|
53
|
+
### Local Python
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
source .venv/bin/activate
|
|
57
|
+
agent-skill-compiler serve
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Docker
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
cp .env.example .env
|
|
64
|
+
docker compose up --build
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Useful endpoints:
|
|
68
|
+
|
|
69
|
+
- `GET /`
|
|
70
|
+
- `GET /docs`
|
|
71
|
+
- `GET /api/healthz`
|
|
72
|
+
- `POST /api/admin/projects`
|
|
73
|
+
|
|
74
|
+
## Create A Project
|
|
75
|
+
|
|
76
|
+
Protect project creation if needed:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
export ASC_ADMIN_TOKEN=change-me
|
|
80
|
+
agent-skill-compiler serve
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Create a project and its first keypair:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
curl -X POST http://localhost:8000/api/admin/projects \
|
|
87
|
+
-H "Content-Type: application/json" \
|
|
88
|
+
-H "X-ASC-Admin-Token: change-me" \
|
|
89
|
+
-d '{
|
|
90
|
+
"name": "Support API",
|
|
91
|
+
"slug": "support-api",
|
|
92
|
+
"key_name": "backend"
|
|
93
|
+
}'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Example response:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"project": {
|
|
101
|
+
"project_id": "...",
|
|
102
|
+
"name": "Support API",
|
|
103
|
+
"slug": "support-api",
|
|
104
|
+
"created_at": "..."
|
|
105
|
+
},
|
|
106
|
+
"public_key": "asc_pk_...",
|
|
107
|
+
"secret_key": "asc_sk_...",
|
|
108
|
+
"key_name": "backend"
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Backend Usage
|
|
113
|
+
|
|
114
|
+
Recommended environment variables:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
export ASC_BASE_URL=http://localhost:8000
|
|
118
|
+
export ASC_PUBLIC_KEY=asc_pk_your_project_public_key
|
|
119
|
+
export ASC_SECRET_KEY=asc_sk_your_project_secret_key
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Minimal SDK example:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from agent_skill_compiler import SkillCompilerClient
|
|
126
|
+
|
|
127
|
+
client = SkillCompilerClient(
|
|
128
|
+
base_url="http://localhost:8000",
|
|
129
|
+
public_key="asc_pk_your_project_public_key",
|
|
130
|
+
secret_key="asc_sk_your_project_secret_key",
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
run = client.start_run(
|
|
134
|
+
task_name="customer_followup",
|
|
135
|
+
input_text="Review this customer issue and prepare next steps.",
|
|
136
|
+
metadata={"service": "support-api", "workflow": "support_triage"},
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
tool_call = client.record_event(
|
|
140
|
+
run_id=run.run_id,
|
|
141
|
+
agent_name="ResearchAgent",
|
|
142
|
+
action_name="search_docs",
|
|
143
|
+
action_kind="tool_call",
|
|
144
|
+
input_payload={"query": "latest billing escalation policy"},
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
client.record_event(
|
|
148
|
+
run_id=run.run_id,
|
|
149
|
+
agent_name="ResearchAgent",
|
|
150
|
+
action_name="search_docs",
|
|
151
|
+
action_kind="tool_result",
|
|
152
|
+
output_payload={"documents": ["billing-policy-v2"]},
|
|
153
|
+
latency_ms=142,
|
|
154
|
+
parent_event_id=tool_call.event_id,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
client.record_event(
|
|
158
|
+
run_id=run.run_id,
|
|
159
|
+
agent_name="SummaryAgent",
|
|
160
|
+
action_name="final_response",
|
|
161
|
+
action_kind="final_output",
|
|
162
|
+
output_payload={"response": "Prepared next steps for the support team."},
|
|
163
|
+
latency_ms=85,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
client.finish_run(run_id=run.run_id, status="success")
|
|
167
|
+
client.close()
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Frontend Usage
|
|
171
|
+
|
|
172
|
+
Your separate frontend should use the `public_key` only.
|
|
173
|
+
|
|
174
|
+
Project-scoped read endpoints:
|
|
175
|
+
|
|
176
|
+
- `GET /api/runs?public_key=asc_pk_...`
|
|
177
|
+
- `GET /api/runs/{run_id}?public_key=asc_pk_...`
|
|
178
|
+
- `GET /api/skills?public_key=asc_pk_...`
|
|
179
|
+
- `POST /api/analyze?public_key=asc_pk_...`
|
|
180
|
+
|
|
181
|
+
## API Reference
|
|
182
|
+
|
|
183
|
+
Trusted backend writes:
|
|
184
|
+
|
|
185
|
+
- `POST /api/runs/start`
|
|
186
|
+
- `POST /api/runs/{run_id}/events`
|
|
187
|
+
- `POST /api/runs/{run_id}/finish`
|
|
188
|
+
|
|
189
|
+
Project reads:
|
|
190
|
+
|
|
191
|
+
- `GET /api/runs`
|
|
192
|
+
- `GET /api/runs/{run_id}`
|
|
193
|
+
- `GET /api/skills`
|
|
194
|
+
- `POST /api/analyze`
|
|
195
|
+
|
|
196
|
+
Admin and ops:
|
|
197
|
+
|
|
198
|
+
- `GET /api/healthz`
|
|
199
|
+
- `GET /api/config`
|
|
200
|
+
- `GET /api/projects`
|
|
201
|
+
- `GET /api/projects/{project_id}/keys`
|
|
202
|
+
- `POST /api/admin/projects`
|
|
203
|
+
- `POST /api/admin/reset`
|
|
204
|
+
- `POST /api/reports/generate`
|
|
205
|
+
- `GET /reports/latest`
|
|
206
|
+
|
|
207
|
+
Write requests must include:
|
|
208
|
+
|
|
209
|
+
- `X-ASC-Public-Key`
|
|
210
|
+
- `X-ASC-Secret-Key`
|
|
211
|
+
|
|
212
|
+
## Notes
|
|
213
|
+
|
|
214
|
+
- SQLite is used for local-first persistence.
|
|
215
|
+
- Candidate skills are heuristic suggestions derived from repeated event subsequences.
|
|
216
|
+
- HTML reporting remains available through the report endpoints and CLI.
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
MIT
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Agent Skill Compiler
|
|
2
|
+
|
|
3
|
+
Agent Skill Compiler is an API-first backend and Python SDK for collecting agent traces, storing project-scoped runs, and analyzing repeated execution patterns into candidate skills.
|
|
4
|
+
|
|
5
|
+
This repository intentionally ships no frontend. The supported deployment model is:
|
|
6
|
+
|
|
7
|
+
1. deploy this package as your tracing and analysis API
|
|
8
|
+
2. instrument your backend agents with the Python SDK using `base_url`, `public_key`, and `secret_key`
|
|
9
|
+
3. build your frontend in a separate repo against this API using `base_url` plus the project `public_key`
|
|
10
|
+
|
|
11
|
+
## Auth Model
|
|
12
|
+
|
|
13
|
+
- trusted backend writes: `public_key` + `secret_key`
|
|
14
|
+
- frontend reads: `public_key`
|
|
15
|
+
- admin/project provisioning: optional `ASC_ADMIN_TOKEN`
|
|
16
|
+
|
|
17
|
+
Never expose the `secret_key` in browser code.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install agent-skill-compiler
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For local development:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python3.11 -m venv .venv
|
|
29
|
+
source .venv/bin/activate
|
|
30
|
+
pip install -e .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Run The API
|
|
34
|
+
|
|
35
|
+
### Local Python
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
source .venv/bin/activate
|
|
39
|
+
agent-skill-compiler serve
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Docker
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cp .env.example .env
|
|
46
|
+
docker compose up --build
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Useful endpoints:
|
|
50
|
+
|
|
51
|
+
- `GET /`
|
|
52
|
+
- `GET /docs`
|
|
53
|
+
- `GET /api/healthz`
|
|
54
|
+
- `POST /api/admin/projects`
|
|
55
|
+
|
|
56
|
+
## Create A Project
|
|
57
|
+
|
|
58
|
+
Protect project creation if needed:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
export ASC_ADMIN_TOKEN=change-me
|
|
62
|
+
agent-skill-compiler serve
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Create a project and its first keypair:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
curl -X POST http://localhost:8000/api/admin/projects \
|
|
69
|
+
-H "Content-Type: application/json" \
|
|
70
|
+
-H "X-ASC-Admin-Token: change-me" \
|
|
71
|
+
-d '{
|
|
72
|
+
"name": "Support API",
|
|
73
|
+
"slug": "support-api",
|
|
74
|
+
"key_name": "backend"
|
|
75
|
+
}'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Example response:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"project": {
|
|
83
|
+
"project_id": "...",
|
|
84
|
+
"name": "Support API",
|
|
85
|
+
"slug": "support-api",
|
|
86
|
+
"created_at": "..."
|
|
87
|
+
},
|
|
88
|
+
"public_key": "asc_pk_...",
|
|
89
|
+
"secret_key": "asc_sk_...",
|
|
90
|
+
"key_name": "backend"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Backend Usage
|
|
95
|
+
|
|
96
|
+
Recommended environment variables:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
export ASC_BASE_URL=http://localhost:8000
|
|
100
|
+
export ASC_PUBLIC_KEY=asc_pk_your_project_public_key
|
|
101
|
+
export ASC_SECRET_KEY=asc_sk_your_project_secret_key
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Minimal SDK example:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from agent_skill_compiler import SkillCompilerClient
|
|
108
|
+
|
|
109
|
+
client = SkillCompilerClient(
|
|
110
|
+
base_url="http://localhost:8000",
|
|
111
|
+
public_key="asc_pk_your_project_public_key",
|
|
112
|
+
secret_key="asc_sk_your_project_secret_key",
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
run = client.start_run(
|
|
116
|
+
task_name="customer_followup",
|
|
117
|
+
input_text="Review this customer issue and prepare next steps.",
|
|
118
|
+
metadata={"service": "support-api", "workflow": "support_triage"},
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
tool_call = client.record_event(
|
|
122
|
+
run_id=run.run_id,
|
|
123
|
+
agent_name="ResearchAgent",
|
|
124
|
+
action_name="search_docs",
|
|
125
|
+
action_kind="tool_call",
|
|
126
|
+
input_payload={"query": "latest billing escalation policy"},
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
client.record_event(
|
|
130
|
+
run_id=run.run_id,
|
|
131
|
+
agent_name="ResearchAgent",
|
|
132
|
+
action_name="search_docs",
|
|
133
|
+
action_kind="tool_result",
|
|
134
|
+
output_payload={"documents": ["billing-policy-v2"]},
|
|
135
|
+
latency_ms=142,
|
|
136
|
+
parent_event_id=tool_call.event_id,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
client.record_event(
|
|
140
|
+
run_id=run.run_id,
|
|
141
|
+
agent_name="SummaryAgent",
|
|
142
|
+
action_name="final_response",
|
|
143
|
+
action_kind="final_output",
|
|
144
|
+
output_payload={"response": "Prepared next steps for the support team."},
|
|
145
|
+
latency_ms=85,
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
client.finish_run(run_id=run.run_id, status="success")
|
|
149
|
+
client.close()
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Frontend Usage
|
|
153
|
+
|
|
154
|
+
Your separate frontend should use the `public_key` only.
|
|
155
|
+
|
|
156
|
+
Project-scoped read endpoints:
|
|
157
|
+
|
|
158
|
+
- `GET /api/runs?public_key=asc_pk_...`
|
|
159
|
+
- `GET /api/runs/{run_id}?public_key=asc_pk_...`
|
|
160
|
+
- `GET /api/skills?public_key=asc_pk_...`
|
|
161
|
+
- `POST /api/analyze?public_key=asc_pk_...`
|
|
162
|
+
|
|
163
|
+
## API Reference
|
|
164
|
+
|
|
165
|
+
Trusted backend writes:
|
|
166
|
+
|
|
167
|
+
- `POST /api/runs/start`
|
|
168
|
+
- `POST /api/runs/{run_id}/events`
|
|
169
|
+
- `POST /api/runs/{run_id}/finish`
|
|
170
|
+
|
|
171
|
+
Project reads:
|
|
172
|
+
|
|
173
|
+
- `GET /api/runs`
|
|
174
|
+
- `GET /api/runs/{run_id}`
|
|
175
|
+
- `GET /api/skills`
|
|
176
|
+
- `POST /api/analyze`
|
|
177
|
+
|
|
178
|
+
Admin and ops:
|
|
179
|
+
|
|
180
|
+
- `GET /api/healthz`
|
|
181
|
+
- `GET /api/config`
|
|
182
|
+
- `GET /api/projects`
|
|
183
|
+
- `GET /api/projects/{project_id}/keys`
|
|
184
|
+
- `POST /api/admin/projects`
|
|
185
|
+
- `POST /api/admin/reset`
|
|
186
|
+
- `POST /api/reports/generate`
|
|
187
|
+
- `GET /reports/latest`
|
|
188
|
+
|
|
189
|
+
Write requests must include:
|
|
190
|
+
|
|
191
|
+
- `X-ASC-Public-Key`
|
|
192
|
+
- `X-ASC-Secret-Key`
|
|
193
|
+
|
|
194
|
+
## Notes
|
|
195
|
+
|
|
196
|
+
- SQLite is used for local-first persistence.
|
|
197
|
+
- Candidate skills are heuristic suggestions derived from repeated event subsequences.
|
|
198
|
+
- HTML reporting remains available through the report endpoints and CLI.
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Backend Integration Guide
|
|
2
|
+
|
|
3
|
+
Use Agent Skill Compiler as a separate backend service beside your existing agents.
|
|
4
|
+
|
|
5
|
+
## Integration Contract
|
|
6
|
+
|
|
7
|
+
Your backend needs:
|
|
8
|
+
|
|
9
|
+
- `base_url`
|
|
10
|
+
- `public_key`
|
|
11
|
+
- `secret_key`
|
|
12
|
+
|
|
13
|
+
Your frontend needs:
|
|
14
|
+
|
|
15
|
+
- `base_url`
|
|
16
|
+
- `public_key`
|
|
17
|
+
|
|
18
|
+
Never expose the `secret_key` in browser code.
|
|
19
|
+
|
|
20
|
+
## 1. Run The API
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
agent-skill-compiler serve
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
docker compose up --build
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 2. Create A Project
|
|
33
|
+
|
|
34
|
+
Optional:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export ASC_ADMIN_TOKEN=change-me
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
curl -X POST http://localhost:8000/api/admin/projects \
|
|
42
|
+
-H "Content-Type: application/json" \
|
|
43
|
+
-H "X-ASC-Admin-Token: change-me" \
|
|
44
|
+
-d '{
|
|
45
|
+
"name": "Support API",
|
|
46
|
+
"slug": "support-api",
|
|
47
|
+
"key_name": "backend"
|
|
48
|
+
}'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Save the returned `public_key` and `secret_key`.
|
|
52
|
+
|
|
53
|
+
## 3. Configure Your Backend
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
export ASC_BASE_URL=http://localhost:8000
|
|
57
|
+
export ASC_PUBLIC_KEY=asc_pk_your_project_public_key
|
|
58
|
+
export ASC_SECRET_KEY=asc_sk_your_project_secret_key
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from agent_skill_compiler import SkillCompilerClient
|
|
63
|
+
|
|
64
|
+
compiler = SkillCompilerClient(
|
|
65
|
+
base_url="http://localhost:8000",
|
|
66
|
+
public_key="asc_pk_your_project_public_key",
|
|
67
|
+
secret_key="asc_sk_your_project_secret_key",
|
|
68
|
+
)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 4. Instrument One Real Workflow
|
|
72
|
+
|
|
73
|
+
Wrap one real backend path with:
|
|
74
|
+
|
|
75
|
+
- `start_run(...)`
|
|
76
|
+
- `record_event(...)`
|
|
77
|
+
- `finish_run(...)`
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
run = compiler.start_run(
|
|
81
|
+
task_name="support_review",
|
|
82
|
+
input_text=payload["message"],
|
|
83
|
+
metadata={"service": "support-api", "route": "/support/review"},
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
tool_call = compiler.record_event(
|
|
87
|
+
run_id=run.run_id,
|
|
88
|
+
agent_name="SupportResearcher",
|
|
89
|
+
action_name="search_docs",
|
|
90
|
+
action_kind="tool_call",
|
|
91
|
+
input_payload={"query": "billing escalation policy"},
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
compiler.record_event(
|
|
95
|
+
run_id=run.run_id,
|
|
96
|
+
agent_name="SupportResearcher",
|
|
97
|
+
action_name="search_docs",
|
|
98
|
+
action_kind="tool_result",
|
|
99
|
+
output_payload={"documents": ["billing-policy-v2"]},
|
|
100
|
+
parent_event_id=tool_call.event_id,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
compiler.finish_run(run_id=run.run_id, status="success")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 5. Verify Reads
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
curl "http://localhost:8000/api/runs?public_key=asc_pk_your_project_public_key"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
curl "http://localhost:8000/api/skills?public_key=asc_pk_your_project_public_key"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
curl -X POST "http://localhost:8000/api/analyze?public_key=asc_pk_your_project_public_key"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Frontend Repo Pattern
|
|
121
|
+
|
|
122
|
+
Your separate frontend can read project data with:
|
|
123
|
+
|
|
124
|
+
- `GET /api/runs?public_key=...`
|
|
125
|
+
- `GET /api/runs/{run_id}?public_key=...`
|
|
126
|
+
- `GET /api/skills?public_key=...`
|
|
127
|
+
- `POST /api/analyze?public_key=...`
|
|
128
|
+
|
|
129
|
+
## Common Mistakes
|
|
130
|
+
|
|
131
|
+
- Exposing the `secret_key` to the browser.
|
|
132
|
+
- Recording only final output and no intermediate steps.
|
|
133
|
+
- Instrumenting too many workflows before verifying one path end to end.
|
|
134
|
+
- Forgetting to call `finish_run(...)`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "agent-skill-compiler"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Local-first toolkit for mining repeated multi-agent execution patterns into candidate skills."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Open Source Contributors" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["agents", "ai", "skills", "tracing", "analysis", "tooling"]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"fastapi>=0.115.0",
|
|
18
|
+
"httpx>=0.28.1",
|
|
19
|
+
"jinja2>=3.1.6",
|
|
20
|
+
"pydantic>=2.11.0",
|
|
21
|
+
"pydantic-settings>=2.13.1",
|
|
22
|
+
"rich>=14.0.0",
|
|
23
|
+
"typer>=0.15.3",
|
|
24
|
+
"uvicorn>=0.34.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
agent-skill-compiler = "agent_skill_compiler.cli.app:main"
|
|
29
|
+
|
|
30
|
+
[tool.hatch.build.targets.wheel]
|
|
31
|
+
packages = ["src/agent_skill_compiler"]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"""Analysis exports."""
|
|
2
|
+
|
|
3
|
+
from agent_skill_compiler.analysis.pipeline import AnalysisService, PatternMiner, SequenceNormalizer, SkillSuggester
|
|
4
|
+
from agent_skill_compiler.models.domain import AnalysisSummary
|
|
5
|
+
|
|
6
|
+
__all__ = ["AnalysisService", "AnalysisSummary", "PatternMiner", "SequenceNormalizer", "SkillSuggester"]
|