49 lines
1.7 KiB
Markdown
49 lines
1.7 KiB
Markdown
<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
|
|
|
|
# ctx.agentExecution
|
|
|
|
`AgentExecutionService` (abstract seam) — provided by `@deepseek-ai/dsh-agent-execution`.
|
|
|
|
Ambient Agent identity within one process-local asynchronous chain.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-execution/src/index.ts#L18)
|
|
|
|
### ctx.agentExecution.current()
|
|
|
|
```ts website-api
|
|
current(): AgentExecution | undefined
|
|
```
|
|
|
|
Read the active execution without requiring one.
|
|
|
|
**Returns** the inherited execution, or `undefined` outside/inside a cleared boundary.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-execution/src/index.ts#L24)
|
|
|
|
### ctx.agentExecution.require()
|
|
|
|
```ts website-api
|
|
require(): AgentExecution
|
|
```
|
|
|
|
Read the active execution and fail when no boundary is active.
|
|
|
|
**Returns** the inherited execution.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-execution/src/index.ts#L31)
|
|
|
|
### ctx.agentExecution.run(execution, operation)
|
|
|
|
```ts website-api
|
|
run<T>(execution: AgentExecution | undefined, operation: () => T): T
|
|
```
|
|
|
|
Run an operation inside an execution boundary. Passing `undefined` clears an inherited execution; the exact synchronous value or Promise is returned.
|
|
|
|
- `execution` — execution to inherit, or `undefined` for a clearing boundary.
|
|
- `operation` — synchronous or asynchronous operation to invoke.
|
|
|
|
**Returns** the exact value returned by `operation`.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-execution/src/index.ts#L41)
|