MCPcopy
hub / github.com/CodebuffAI/codebuff / runAgentStep

Function runAgentStep

packages/agent-runtime/src/run-agent-step.ts:100–546  ·  view source on GitHub ↗
(
  params: {
    userId: string | undefined
    userInputId: string
    clientSessionId: string
    costMode?: string
    fingerprintId: string
    repoId: string | undefined
    onResponseChunk: (chunk: string | PrintModeEvent) => void

    agentType: AgentTemplateType
    agentTemplate: AgentTemplate
    fileContext: ProjectFileContext
    agentState: AgentState
    localAgentTemplates: Record<string, AgentTemplate>

    prompt: string | undefined
    spawnParams: Record<string, any> | undefined
    system: string
    n?: number

    trackEvent: TrackEventFn
    promptAiSdk: PromptAiSdkFn
  } & ParamsExcluding<
    typeof processStream,
    | 'agentContext'
    | 'agentState'
    | 'agentStepId'
    | 'agentTemplate'
    | 'fullResponse'
    | 'messages'
    | 'onCostCalculated'
    | 'repoId'
    | 'stream'
  > &
    ParamsExcluding<
      typeof getAgentStreamFromTemplate,
      | 'agentId'
      | 'includeCacheControl'
      | 'messages'
      | 'onCostCalculated'
      | 'template'
    > &
    ParamsExcluding<typeof getAgentTemplate, 'agentId'> &
    ParamsExcluding<
      typeof getAgentPrompt,
      'agentTemplate' | 'promptType' | 'agentState' | 'agentTemplates'
    > &
    ParamsExcluding<
      typeof getMCPToolData,
      'toolNames' | 'mcpServers' | 'writeTo'
    > &
    ParamsExcluding<
      PromptAiSdkFn,
      'messages' | 'model' | 'onCostCalculated' | 'n'
    >,
)

Source from the content-addressed store, hash-verified

98}
99
100export const runAgentStep = async (
101 params: {
102 userId: string | undefined
103 userInputId: string
104 clientSessionId: string
105 costMode?: string
106 fingerprintId: string
107 repoId: string | undefined
108 onResponseChunk: (chunk: string | PrintModeEvent) => void
109
110 agentType: AgentTemplateType
111 agentTemplate: AgentTemplate
112 fileContext: ProjectFileContext
113 agentState: AgentState
114 localAgentTemplates: Record<string, AgentTemplate>
115
116 prompt: string | undefined
117 spawnParams: Record<string, any> | undefined
118 system: string
119 n?: number
120
121 trackEvent: TrackEventFn
122 promptAiSdk: PromptAiSdkFn
123 } & ParamsExcluding<
124 typeof processStream,
125 | 'agentContext'
126 | 'agentState'
127 | 'agentStepId'
128 | 'agentTemplate'
129 | 'fullResponse'
130 | 'messages'
131 | 'onCostCalculated'
132 | 'repoId'
133 | 'stream'
134 > &
135 ParamsExcluding<
136 typeof getAgentStreamFromTemplate,
137 | 'agentId'
138 | 'includeCacheControl'
139 | 'messages'
140 | 'onCostCalculated'
141 | 'template'
142 > &
143 ParamsExcluding<typeof getAgentTemplate, 'agentId'> &
144 ParamsExcluding<
145 typeof getAgentPrompt,
146 'agentTemplate' | 'promptType' | 'agentState' | 'agentTemplates'
147 > &
148 ParamsExcluding<
149 typeof getMCPToolData,
150 'toolNames' | 'mcpServers' | 'writeTo'
151 > &
152 ParamsExcluding<
153 PromptAiSdkFn,
154 'messages' | 'model' | 'onCostCalculated' | 'n'
155 >,
156): Promise<{
157 agentState: AgentState

Calls 15

expireMessagesFunction · 0.90
userMessageFunction · 0.90
withSystemTagsFunction · 0.90
getAgentPromptFunction · 0.90
buildArrayFunction · 0.90
countTokensJsonFunction · 0.90
createCacheDebugSnapshotFunction · 0.90
systemMessageFunction · 0.90

Tested by

no test coverage detected