You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/aw/github-agentic-workflows.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -214,18 +214,18 @@ The YAML frontmatter supports these fields:
214
214
The `custom` engine allows you to define your own GitHub Actions steps instead of using an AI processor. Each step in the `steps` array follows standard GitHub Actions step syntax with `name`, `uses`/`run`, `with`, `env`, etc. This is useful for deterministic workflows that don't require AI processing.
215
215
216
216
**Environment Variables Available to Custom Engines:**
217
-
217
+
218
218
Custom engine steps have access to the following environment variables:
219
-
219
+
220
220
- **`$GH_AW_PROMPT`**: Path to the generated prompt file (`/tmp/gh-aw/aw-prompts/prompt.txt`) containing the markdown content from the workflow. This file contains the natural language instructions that would normally be sent to an AI processor. Custom engines can read this file to access the workflow's markdown content programmatically.
221
221
- **`$GH_AW_SAFE_OUTPUTS`**: Path to the safe outputs file (when safe-outputs are configured). Used for writing structured output that gets processed automatically.
222
222
- **`$GH_AW_MAX_TURNS`**: Maximum number of turns/iterations (when max-turns is configured in engine config).
223
-
223
+
224
224
Example of accessing the prompt content:
225
225
```bash
226
226
# Read the workflow prompt content
227
227
cat $GH_AW_PROMPT
228
-
228
+
229
229
# Process the prompt content in a custom step
230
230
- name: Process workflow instructions
231
231
run: |
@@ -253,7 +253,7 @@ The YAML frontmatter supports these fields:
253
253
log-level: debug # Optional: debug, info (default), warn, error
**Quick purpose:** Help contributors and AI coding agents quickly understand this mono-repo and be productive (build, test, add SDK features, add E2E tests). ✅
4
+
5
+
## Big picture 🔧
6
+
7
+
- The repo implements language SDKs (Node/TS, Python, Go, .NET) that speak to the **Copilot CLI** via **JSON‑RPC** (see `README.md` and `nodejs/src/client.ts`).
8
+
- Typical flow: your App → SDK client → JSON-RPC → Copilot CLI (server mode). The CLI must be installed or you can connect to an external CLI server via the `CLI URL option (language-specific casing)` (Node: `cliUrl`, Go: `CLIUrl`, .NET: `CliUrl`, Python: `cli_url`).
- Language entry points: `nodejs/src/client.ts`, `python/README.md`, `go/README.md`, `dotnet/README.md`
14
+
- Test harness & E2E: `test/harness/*`, Python harness wrapper `python/e2e/testharness/proxy.py`
15
+
- Schemas & type generation: `nodejs/scripts/generate-session-types.ts`
16
+
- Session snapshots used by E2E: `test/snapshots/` (used by the replay proxy)
17
+
18
+
## Developer workflows (commands you’ll use often) ▶️
19
+
20
+
- Monorepo helpers: use `just` tasks from repo root:
21
+
- Install deps: `just install` (runs npm ci, uv pip install -e, go mod download, dotnet restore)
22
+
- Format all: `just format` | Lint all: `just lint` | Test all: `just test`
23
+
- Per-language:
24
+
- Node: `cd nodejs && npm ci` → `npm test` (Vitest), `npm run generate:session-types` to regenerate session-event types
25
+
- Python: `cd python && uv pip install -e ".[dev]"` → `uv run pytest` (E2E tests use the test harness)
26
+
- Go: `cd go && go test ./...`
27
+
- .NET: `cd dotnet && dotnet test test/GitHub.Copilot.SDK.Test.csproj`
28
+
29
+
## Testing & E2E tips ⚙️
30
+
31
+
- E2E runs against a local **replaying CAPI proxy** (see `test/harness/server.ts`). Most language E2E harnesses spawn that server automatically (see `python/e2e/testharness/proxy.py`).
32
+
- Tests rely on YAML snapshot exchanges under `test/snapshots/` — to add test scenarios, add or edit the appropriate YAML files and update tests.
33
+
- The harness prints `Listening: http://...` — tests parse this URL to configure CLI or proxy.
34
+
35
+
## Project-specific conventions & patterns ✅
36
+
37
+
- Tools: each SDK has helper APIs to expose functions as tools; prefer the language's `DefineTool`/`@define_tool`/`AIFunctionFactory.Create` patterns (see language READMEs).
38
+
- Infinite sessions are enabled by default and persist workspace state to `~/.copilot/session-state/{sessionId}`; compaction events are emitted (`session.compaction_start`, `session.compaction_complete`). See language READMEs for usage.
39
+
- Streaming: when `streaming`/`Streaming=true` you receive delta events (`assistant.message_delta`, `assistant.reasoning_delta`) and final events (`assistant.message`, `assistant.reasoning`) — tests expect this behavior.
40
+
- Type generation is centralized in `nodejs/scripts/generate-session-types.ts` and requires the `@github/copilot` schema to be present (often via `npm link` or installed package).
41
+
42
+
## Integration & environment notes ⚠️
43
+
44
+
- The SDK requires a Copilot CLI installation or an external server reachable via the `CLI URL option (language-specific casing)` (Node: `cliUrl`, Go: `CLIUrl`, .NET: `CliUrl`, Python: `cli_url`) or `COPILOT_CLI_PATH`.
45
+
- Some scripts (typegen, formatting) call external tools: `gofmt`, `dotnet format`, `tsx` (available via npm), `quicktype`/`quicktype-core` (used by the Node typegen script), and `prettier` (provided as an npm devDependency). Most of these are available through the repo's package scripts or devDependencies—run `just install` (and `cd nodejs && npm ci`) to install them. Ensure the required tools are available in CI / developer machines.
46
+
- Tests may assume `node >= 18`, `python >= 3.9`, platform differences handled (Windows uses `shell=True` for npx in harness).
- Unit tests: `nodejs/test`, `python/*`, `go/*`, `dotnet/test`
52
+
- E2E tests: `*/e2e/` folders that use the shared replay proxy and `test/snapshots/`
53
+
- Generated types: update schema in `@github/copilot` then run `cd nodejs && npm run generate:session-types` and commit generated files in `src/generated` or language generated location.
0 commit comments