Skip to content

Class: CodeAct

Code-acting agent (dspy.CodeAct).

URI: dspy:CodeAct

 classDiagram
    class CodeAct
    click CodeAct href "../CodeAct/"
      Predictor <|-- CodeAct
        click Predictor href "../Predictor/"

      CodeAct : callbacks

      CodeAct : compiled

      CodeAct : config





        CodeAct --> "0..1" Any : config
        click Any href "../Any/"



      CodeAct : demos





        CodeAct --> "*" Example : demos
        click Example href "../Example/"



      CodeAct : description

      CodeAct : history





        CodeAct --> "*" LMHistoryEntry : history
        click LMHistoryEntry href "../LMHistoryEntry/"



      CodeAct : id

      CodeAct : interpreter_kind

      CodeAct : lm





        CodeAct --> "0..1" BaseLM : lm
        click BaseLM href "../BaseLM/"



      CodeAct : max_iters

      CodeAct : name

      CodeAct : predictors





        CodeAct --> "*" Predictor : predictors
        click Predictor href "../Predictor/"



      CodeAct : signature





        CodeAct --> "0..1" Signature : signature
        click Signature href "../Signature/"



      CodeAct : stage

      CodeAct : sub_modules





        CodeAct --> "*" Module : sub_modules
        click Module href "../Module/"



      CodeAct : tools





        CodeAct --> "*" Tool : tools
        click Tool href "../Tool/"



      CodeAct : traces





        CodeAct --> "*" Any : traces
        click Any href "../Any/"



      CodeAct : train





        CodeAct --> "*" Example : train
        click Example href "../Example/"



Inheritance

Slots

Name Cardinality and Range Description Inheritance
tools *
Tool
Tools available to an agent direct
max_iters 0..1
Integer
Maximum number of reasoning / tool-call iterations (ReAct family) direct
interpreter_kind 1
String
Concrete code interpreter implementation (matches an InterpreterKind valu... direct
signature 0..1
Signature
Signature attached to a predictor Predictor
lm 0..1
BaseLM
Language model bound to this predictor / program Predictor
config 0..1
Any
Default keyword arguments forwarded to the underlying LM Predictor
stage 0..1
Identifier
Random per-predictor stage id used to bucket traces Predictor
demos *
Example
Few-shot demonstrations attached to a predictor Predictor
traces *
Any
Bootstrapped traces gathered by teleprompters Predictor
train *
Example
Training examples attached to a predictor (used by some optimizers) Predictor
compiled 0..1
Boolean
Whether the module has been compiled by a teleprompter Module
callbacks *
String
Dotted import paths of callbacks registered on the module Module
history *
LMHistoryEntry
Per-module call history of LM requests / responses Module
predictors *
Predictor
Predictor children of a composite Module (named_predictors()) Module
sub_modules *
Module
Nested Module children of a composite Module Module
id 1
Identifier
Stable opaque identifier for an instance NamedThing
name 0..1
String
Short human-readable name NamedThing
description 0..1
String
Free-form description NamedThing

In Subsets

Identifier and Mapping Information

Annotations

property value
dspy_source_paths ['dspy/predict/code_act.py']
dspy_source_urls ['https://github.com/stanfordnlp/dspy/blob/main/dspy/predict/code_act.py']

Schema Source

Mappings

Mapping Type Mapped Value
self dspy:CodeAct
native dspy:CodeAct
close nexus:AiAgent, uco_action:ActionPattern

LinkML Source

Direct

name: CodeAct
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/predict/code_act.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/predict/code_act.py
description: Code-acting agent (``dspy.CodeAct``).
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
close_mappings:
- nexus:AiAgent
- uco_action:ActionPattern
is_a: Predictor
slots:
- tools
- max_iters
- interpreter_kind

Induced

name: CodeAct
annotations:
  dspy_source_paths:
    tag: dspy_source_paths
    value:
    - dspy/predict/code_act.py
  dspy_source_urls:
    tag: dspy_source_urls
    value:
    - https://github.com/stanfordnlp/dspy/blob/main/dspy/predict/code_act.py
description: Code-acting agent (``dspy.CodeAct``).
in_subset:
- modules
from_schema: https://w3id.org/lmodel/dspy
close_mappings:
- nexus:AiAgent
- uco_action:ActionPattern
is_a: Predictor
attributes:
  tools:
    name: tools
    description: Tools available to an agent.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - ReAct
    - ReActV2
    - CodeAct
    range: Tool
    multivalued: true
    inlined: true
    inlined_as_list: true
  max_iters:
    name: max_iters
    description: Maximum number of reasoning / tool-call iterations (ReAct family).
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - ReAct
    - ReActV2
    - ProgramOfThought
    - CodeAct
    - AvatarOptimizer
    range: integer
    minimum_value: 1
  interpreter_kind:
    name: interpreter_kind
    description: Concrete code interpreter implementation (matches an ``InterpreterKind``
      value).
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - ProgramOfThought
    - CodeAct
    - Interpreter
    range: string
    required: true
  signature:
    name: signature
    description: Signature attached to a predictor.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - Completions
    - Predictor
    range: Signature
    inlined: true
  lm:
    name: lm
    description: Language model bound to this predictor / program.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - Predictor
    - RLM
    - Settings
    range: BaseLM
    inlined: true
  config:
    name: config
    description: Default keyword arguments forwarded to the underlying LM.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - LMRequest
    - Predictor
    range: Any
  stage:
    name: stage
    description: Random per-predictor stage id used to bucket traces.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - Predictor
    range: Identifier
  demos:
    name: demos
    description: Few-shot demonstrations attached to a predictor.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - Predictor
    range: Example
    multivalued: true
    inlined: true
    inlined_as_list: true
  traces:
    name: traces
    description: Bootstrapped traces gathered by teleprompters.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - Predictor
    range: Any
    multivalued: true
  train:
    name: train
    description: Training examples attached to a predictor (used by some optimizers).
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - Predictor
    range: Example
    multivalued: true
    inlined: true
    inlined_as_list: true
  compiled:
    name: compiled
    description: Whether the module has been compiled by a teleprompter.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    ifabsent: boolean(False)
    owner: CodeAct
    domain_of:
    - Module
    range: boolean
  callbacks:
    name: callbacks
    description: Dotted import paths of callbacks registered on the module.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - BaseLM
    - Adapter
    - Module
    - Settings
    range: string
    multivalued: true
  history:
    name: history
    description: Per-module call history of LM requests / responses.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - BaseLM
    - Module
    range: LMHistoryEntry
    multivalued: true
    inlined: true
    inlined_as_list: true
  predictors:
    name: predictors
    description: Predictor children of a composite Module (named_predictors()).
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - Module
    range: Predictor
    multivalued: true
    inlined: true
    inlined_as_list: true
  sub_modules:
    name: sub_modules
    description: Nested Module children of a composite Module.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    owner: CodeAct
    domain_of:
    - Module
    range: Module
    multivalued: true
    inlined: true
    inlined_as_list: true
  id:
    name: id
    description: Stable opaque identifier for an instance.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    slot_uri: schema:identifier
    identifier: true
    owner: CodeAct
    domain_of:
    - NamedThing
    range: Identifier
    required: true
  name:
    name: name
    description: Short human-readable name.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    slot_uri: rdfs:label
    owner: CodeAct
    domain_of:
    - NamedThing
    - LMToolCallPart
    - LMMessage
    - LMToolSpec
    range: string
  description:
    name: description
    description: Free-form description.
    from_schema: https://w3id.org/lmodel/dspy
    rank: 1000
    slot_uri: dct:description
    owner: CodeAct
    domain_of:
    - NamedThing
    - LMToolSpec
    range: string